]>
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
7 // Copyright: (c) 1996 P. Foggia
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_DEMOS_BOMBS_GAME_H_
12 #define _WX_DEMOS_BOMBS_GAME_H_
14 #define BG_HIDDEN 0x100
16 #define BG_MARKED 0x400
17 #define BG_EXPLODED 0x800
18 #define BG_SELECTED 0x080
28 m_width
= m_height
= 0;
34 int GetWidth() const { return m_width
; };
35 int GetHeight() const { return m_height
; };
37 int Get(int x
, int y
) const
39 return m_field
[x
+y
*m_width
];
42 int IsFocussed(int x
, int y
) const
44 return (m_gridFocusX
== x
) && (m_gridFocusY
== y
);
47 int IsHidden(int x
, int y
) const
49 return Get(x
,y
) & BG_HIDDEN
;
52 int IsMarked(int x
, int y
) const
54 return Get(x
,y
) & BG_MARKED
;
57 int IsBomb(int x
, int y
) const
59 return Get(x
,y
) & BG_BOMB
;
62 int IsExploded(int x
, int y
) const
64 return Get(x
,y
) & BG_EXPLODED
;
67 int IsSelected(int x
, int y
) const
69 return Get(x
,y
) & BG_SELECTED
;
72 int GetNumBombs() const
74 return m_numBombCells
;
77 int GetNumRemainingCells() const
79 return m_numRemainingCells
;
82 int GetNumMarkedCells() const
84 return m_numMarkedCells
;
88 bool Init(int width
, int height
, bool easyCorner
= false);
91 // Marks/unmarks a cell
92 void Mark(int x
, int y
);
95 void Unhide(int x
, int y
, bool b_selected
);
97 // Makes a cell exploded
98 void Explode(int x
, int y
);
105 // Current difficulty level (Determines grid size).
108 int m_width
, m_height
;
110 int m_numBombCells
, m_numRemainingCells
, m_numMarkedCells
;
114 #endif // #ifndef _WX_DEMOS_BOMBS_GAME_H_