-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMinesweeper.h
48 lines (45 loc) · 1.06 KB
/
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
//
// Created by qwe on 18.05.2022.
//
#ifndef PROJECTKA_MINESWEEPER_H
#define PROJECTKA_MINESWEEPER_H
#include <gtkmm.h>
#include <iostream>
#include <string>
class Time{
int seconds;
int minutes;
std::string clock;
public:
Time();
Time& operator++();
void clear();
std::string show_time();
};
class Minesweeper: public Gtk::ApplicationWindow {
Gtk::Box *box;
Gtk::Button button[10][10];
bool first_click;
int status[10][10];
bool visited[10][10];
int flag[10][10];
Gtk::Grid *grid;
Glib::RefPtr <Gtk::Label> timer_label;
Glib::RefPtr <Gtk::Label> flags_left;
bool flag_fail;
Glib::RefPtr <Gtk::Builder> ui;
Glib::RefPtr <Gtk::Button> play_button;
Time timer;
void clear_cells();
void plant_mines();
bool flag_put(GdkEventButton *event, int i, int j);
int count_flags;
void new_game();
public:
Minesweeper();
bool timer_change();
void on_button_clicked(int i, int j);
void open_cells(int x, int y);
int count_cells(int x, int y);
};
#endif //PROJECTKA_MINESWEEPER_H