-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainGUI.h
42 lines (35 loc) · 983 Bytes
/
MainGUI.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
#pragma once
#include "wx/wx.h"
#include <memory>
enum class Mine { Planted, Empty };
enum ID {
ID_EASY = 20001,
ID_MEDIUM,
ID_HARD,
ID_NEW_GAME,
ID_CLOSE_GAME,
};
class MainGUI : public wxFrame {
public:
MainGUI();
protected:
int fieldWidth = 16;
int fieldHeight = 16;
int mines = 40;
int clickedSquares = 0;
std::vector<std::unique_ptr<wxButton>> buttons;
std::vector<Mine> fieldMines;
wxGridSizer *buttonGrid;
int CountNeighbours(int buttonX, int buttonY);
void DiscoverMine(int buttonX, int buttonY, int buttonIndex);
void Sweep(int buttonX, int buttonY, int buttonIndex);
void GenerateNewField(int newFieldWidth, int newFieldHeight, int newMines);
void DisplayBombsLocation();
void GameOverReset();
private:
void OnButtonClicked(wxCommandEvent &event);
void OnButtonRightClicked(wxMouseEvent &event);
void SetDifficulty(wxCommandEvent &event);
void NewGame(wxCommandEvent &event);
void CloseGame(wxCommandEvent &event);
};