-
Notifications
You must be signed in to change notification settings - Fork 0
/
minesweeper.h
54 lines (46 loc) · 1015 Bytes
/
minesweeper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef __MINESWEEPER_H__
#define __MINESWEEPER_H__
#include "wx/wx.h"
#include "wx/stack.h"
#include <vector>
#include "field.h"
#define PROB 0.2
#define TIMER_ID 1000
class Minesweeper : public wxApp
{
public:
virtual bool OnInit();
};
class MainFrame : public wxFrame
{
public:
MainFrame(const wxString&);
~MainFrame();
void OnExitProgram(wxCloseEvent&);
void OnMouseEvent(wxMouseEvent&);
void OnNewGame(wxCommandEvent&);
void OnExitGame(wxCommandEvent&);
void UnCover(int, int);
void Reveal();
void OnTimer(wxTimerEvent&);
void StopTimer();
private:
Field * matrix[9][9];
wxPanel * topPanel;
int interval{0};
std::vector<int> minesLoci;
wxTimer * m_timer;
wxStaticText * clockText;
wxStaticText * flagText;
wxStack<Field*> st;
bool visited[81] {false};
bool instack[81] {false};
bool IsFieldValid(int,int);
wxString FormatClock();
wxDECLARE_EVENT_TABLE();
};
enum
{
FIELD_EMPTY = 0, FIELD_MINE
};
#endif