]> git.saurik.com Git - wxWidgets.git/blame - samples/bombs/game.h
Fixed problem with mouse events getting sent to wrong
[wxWidgets.git] / samples / bombs / game.h
CommitLineData
025e88c5
JS
1//---------------------------------------------------------------
2// game.h
3// Definition of the class BombsGame, containing the data for a
4// playfield
5//---------------------------------------------------------------
6#ifndef GAME_H
7#define GAME_H
8
9#define BG_HIDDEN 0x100
10#define BG_BOMB 0x200
11#define BG_MARKED 0x400
12#define BG_EXPLODED 0x800
13#define BG_MASK 0x0FF
14
15
16#include <stddef.h>
17
18class BombsGame
19 { protected:
20 int width,height;
21 short *field;
22 int bombs,normal_cells;
23 public:
24 BombsGame() { width=height=0; field=NULL; };
25 ~BombsGame();
26 int Init(int width, int height);
27 int GetWidth() { return width; };
28 int GetHeight() { return height; };
29 int Get(int x, int y) { return field[x+y*width]; };
30 void Mark(int x, int y);
31 void Unhide(int x, int y);
32 void Explode(int x, int y);
33 int IsHidden(int x, int y) { return Get(x,y) & BG_HIDDEN; };
34 int IsMarked(int x, int y) { return Get(x,y) & BG_MARKED; };
35 int IsBomb(int x, int y) { return Get(x,y) & BG_BOMB; };
36 int IsExploded(int x, int y) { return Get(x,y) & BG_EXPLODED; };
37 int GetBombs() { return bombs; };
38 int GetRemainingCells() { return normal_cells; };
39 };
40
41#endif /* def GAME_H */
42