1 /*****************************************************************************
2  * LibreMines                                                                *
3  * Copyright (C) 2020-2021  Bruno Bollos Correa                              *
4  *                                                                           *
5  * This program is free software: you can redistribute it and/or modify      *
6  * it under the terms of the GNU General Public License as published by      *
7  * the Free Software Foundation, either version 3 of the License, or         *
8  * (at your option) any later version.                                       *
9  *                                                                           *
10  * This program is distributed in the hope that it will be useful,           *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
13  * GNU General Public License for more details.                              *
14  *                                                                           *
15  * You should have received a copy of the GNU General Public License         *
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.     *
17  *****************************************************************************
18  */
19 
20 
21 #ifndef COMMON_H
22 #define COMMON_H
23 
24 #include <QtWidgets>
25 
26 /**
27  * @brief
28  *
29  */
30 enum CELL_STATE: qint8{
31     MINE = -1,
32     ZERO = 0,
33     ONE = 1,
34     TWO = 2,
35     THREE = 3,
36     FOUR = 4,
37     FIVE = 5,
38     SIX = 6,
39     SEVEN = 7,
40     EIGHT = 8
41 };
42 
43 /**
44  * @brief
45  *
46  */
47 enum GAME_DIFFICULTY: uchar{
48     NONE,
49     EASY,
50     MEDIUM,
51     HARD,
52     CUSTOMIZED
53 };
54 
55 
56 class Vector2Dshort
57 {
58 public:
59     Vector2Dshort();
60     Vector2Dshort(const qint16 _x, const qint16 _y);
61 
62     float length() const;
63     float distanceToPoint(const Vector2Dshort& point) const;
64 
65     short x;
66     short y;
67 
68 
69 };
70 
71 struct KeyboardController
72 {
73     bool ctrlPressed;
74     bool active;
75     uchar currentX;
76     uchar currentY;
77 
78     int keyLeft;
79     int keyDown;
80     int keyRight;
81     int keyUp;
82     int keyReleaseCell;
83     int keyFlagCell;
84     int keyCenterCell;
85 
86     bool valid;
87 };
88 
89 
90 
91 #endif // COMMON_H
92