]>
Commit | Line | Data |
---|---|---|
025e88c5 JS |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: bombs.h | |
3 | // Purpose: Bombs game | |
4 | // Author: P. Foggia 1996 | |
c8059953 | 5 | // Modified by: Wlodzimierz Skiba (ABX) since 2003 |
025e88c5 | 6 | // Created: 1996 |
025e88c5 JS |
7 | // Copyright: (c) 1996 P. Foggia |
8 | // Licence: wxWindows licence | |
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | ||
0c65afdb DS |
11 | #ifndef _WX_DEMOS_BOMBS_BOMBS_H_ |
12 | #define _WX_DEMOS_BOMBS_BOMBS_H_ | |
025e88c5 JS |
13 | |
14 | #include "game.h" | |
15 | ||
0c65afdb | 16 | class BombsFrame; |
025e88c5 JS |
17 | |
18 | /* | |
19 | * Class representing the entire Application | |
20 | */ | |
0c65afdb | 21 | class BombsApp: public wxApp |
025e88c5 | 22 | { |
0c65afdb DS |
23 | public: |
24 | virtual bool OnInit(); | |
25 | ||
26 | private : | |
27 | BombsFrame *m_frame; | |
28 | ||
29 | BombsGame m_game; | |
025e88c5 | 30 | |
025e88c5 JS |
31 | }; |
32 | ||
0c65afdb | 33 | DECLARE_APP(BombsApp) |
025e88c5 | 34 | |
0c65afdb | 35 | class BombsCanvas; |
025e88c5 | 36 | |
0c65afdb | 37 | class BombsFrame : public wxFrame |
025e88c5 | 38 | { |
0c65afdb DS |
39 | public: |
40 | ||
41 | BombsFrame(BombsGame *bombsGame); | |
42 | ||
23290a8c | 43 | void NewGame(int level, bool query); |
0c65afdb DS |
44 | |
45 | private: | |
46 | ||
c8059953 WS |
47 | void OnNewGame(wxCommandEvent& event); |
48 | void OnEasyGame(wxCommandEvent& event); | |
49 | void OnMediumGame(wxCommandEvent& event); | |
50 | void OnHardGame(wxCommandEvent& event); | |
0c65afdb | 51 | |
43c3922b WS |
52 | void OnEasyCorner(wxCommandEvent& event); |
53 | ||
0c65afdb DS |
54 | void OnExit(wxCommandEvent& event); |
55 | ||
56 | void OnAbout(wxCommandEvent& event); | |
57 | ||
58 | BombsGame *m_game; | |
43c3922b WS |
59 | bool m_easyCorner; |
60 | int m_lastLevel; | |
0c65afdb DS |
61 | |
62 | // Subwindows for reference within the program. | |
63 | BombsCanvas *m_canvas; | |
64 | ||
65 | DECLARE_EVENT_TABLE() | |
025e88c5 JS |
66 | }; |
67 | ||
0c65afdb DS |
68 | // App specific menu identifiers |
69 | enum | |
025e88c5 | 70 | { |
c8059953 | 71 | bombsID_LEVEL = wxID_HIGHEST, |
0c65afdb DS |
72 | bombsID_EASY, |
73 | bombsID_MEDIUM, | |
43c3922b WS |
74 | bombsID_HARD, |
75 | bombsID_EASYCORNER | |
025e88c5 JS |
76 | }; |
77 | ||
0c65afdb DS |
78 | class BombsCanvas : public wxPanel |
79 | { | |
80 | public: | |
81 | ||
82 | // Constructor and destructor | |
83 | ||
84 | BombsCanvas(wxFrame *parent, BombsGame *game); | |
85 | ||
86 | void UpdateGridSize(); | |
87 | ||
88 | wxSize GetGridSizeInPixels() const; | |
89 | ||
d3c7fc99 | 90 | virtual ~BombsCanvas(); |
0c65afdb DS |
91 | |
92 | private: | |
93 | ||
94 | void OnPaint(wxPaintEvent& event); | |
95 | void DrawField(wxDC *, int xc1, int yc1, int xc2, int yc2); | |
96 | void RefreshField(int xc1, int yc1, int xc2, int yc2); | |
97 | void Uncover(int x, int y); | |
98 | void OnMouseEvent(wxMouseEvent& event); | |
99 | void OnChar(wxKeyEvent& event); | |
100 | ||
101 | BombsGame *m_game; | |
102 | ||
103 | wxBitmap *m_bmp; | |
104 | ||
105 | // Cell size in pixels | |
106 | int m_cellWidth; | |
107 | int m_cellHeight; | |
108 | ||
109 | DECLARE_EVENT_TABLE() | |
110 | }; | |
025e88c5 JS |
111 | |
112 | /* The following sizes should probably be redefined */ | |
113 | /* dimensions of a scroll unit, in pixels */ | |
114 | #define X_UNIT 4 | |
115 | #define Y_UNIT 4 | |
116 | ||
117 | /* the dimensions of a cell, in scroll units are in | |
0c65afdb | 118 | * BombsCanvas::x_cell and y_cell |
025e88c5 JS |
119 | */ |
120 | ||
0c65afdb DS |
121 | #ifdef __WXWINCE__ |
122 | #define BOMBS_FONT wxFont(12, wxSWISS, wxNORMAL, wxNORMAL) | |
123 | #else | |
025e88c5 | 124 | #define BOMBS_FONT wxFont(14, wxROMAN, wxNORMAL, wxNORMAL) |
0c65afdb | 125 | #endif |
025e88c5 | 126 | |
0c65afdb | 127 | #endif // #ifndef _WX_DEMOS_BOMBS_BOMBS_H_ |
025e88c5 | 128 |