]>
git.saurik.com Git - wxWidgets.git/blob - demos/bombs/game.h
1 ///////////////////////////////////////////////////////////////////////////////
4 // Author: P. Foggia 1996
5 // Modified by: Wlodzimierz Skiba (ABX) since 2003
8 // Copyright: (c) 1996 P. Foggia
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_DEMOS_BOMBS_GAME_H_
13 #define _WX_DEMOS_BOMBS_GAME_H_
15 #define BG_HIDDEN 0x100
17 #define BG_MARKED 0x400
18 #define BG_EXPLODED 0x800
19 #define BG_SELECTED 0x080
29 m_width
= m_height
= 0;
35 int GetWidth() const { return m_width
; };
36 int GetHeight() const { return m_height
; };
38 int Get(int x
, int y
) const
40 return m_field
[x
+y
*m_width
];
43 int IsFocussed(int x
, int y
) const
45 return (m_gridFocusX
== x
) && (m_gridFocusY
== y
);
48 int IsHidden(int x
, int y
) const
50 return Get(x
,y
) & BG_HIDDEN
;
53 int IsMarked(int x
, int y
) const
55 return Get(x
,y
) & BG_MARKED
;
58 int IsBomb(int x
, int y
) const
60 return Get(x
,y
) & BG_BOMB
;
63 int IsExploded(int x
, int y
) const
65 return Get(x
,y
) & BG_EXPLODED
;
68 int IsSelected(int x
, int y
) const
70 return Get(x
,y
) & BG_SELECTED
;
73 int GetNumBombs() const
75 return m_numBombCells
;
78 int GetNumRemainingCells() const
80 return m_numRemainingCells
;
83 int GetNumMarkedCells() const
85 return m_numMarkedCells
;
89 bool Init(int width
, int height
, bool easyCorner
= false);
92 // Marks/unmarks a cell
93 void Mark(int x
, int y
);
96 void Unhide(int x
, int y
, bool b_selected
);
98 // Makes a cell exploded
99 void Explode(int x
, int y
);
106 // Current difficulty level (Determines grid size).
109 int m_width
, m_height
;
111 int m_numBombCells
, m_numRemainingCells
, m_numMarkedCells
;
115 #endif // #ifndef _WX_DEMOS_BOMBS_GAME_H_