]>
git.saurik.com Git - wxWidgets.git/blob - demos/bombs/game.h
d32f597855561bb81d050b8420b4928b51cc5a73
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
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 GetNumBombs() const
69 return m_numBombCells
;
72 int GetNumRemainingCells() const
74 return m_numRemainingCells
;
79 bool Init(int width
, int height
, bool easyCorner
= false);
82 // Marks/unmarks a cell
83 void Mark(int x
, int y
);
86 void Unhide(int x
, int y
);
88 // Makes a cell exploded
89 void Explode(int x
, int y
);
96 // Current difficulty level (Determines grid size).
99 int m_width
, m_height
;
101 int m_numBombCells
, m_numRemainingCells
;
105 #endif // #ifndef _WX_DEMOS_BOMBS_GAME_H_