-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.h
46 lines (34 loc) · 775 Bytes
/
game.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
#ifndef GAME_H
#define GAME_H
#include <QMainWindow>
#include <QGraphicsScene>
#include <QTimer>
#include <QDebug>
#include <QKeyEvent>
#include "board.h"
QT_BEGIN_NAMESPACE
namespace Ui { class Game; }
QT_END_NAMESPACE
class Game : public QMainWindow
{
Q_OBJECT
public:
Game(QWidget *parent = nullptr);
~Game();
void keyPressEvent(QKeyEvent *event);
void draw();
private slots:
void tick();
void on_startButton_clicked();
private:
Ui::Game *ui;
QGraphicsScene *scene_;
Board *board_;
QTimer timer_;
const int SQUARE_SIDE = 20;
const int BORDER_DOWN = 520;
const int BORDER_RIGTH = 680;
const int WIDTH = BORDER_RIGTH / SQUARE_SIDE;
const int HEIGTH = BORDER_DOWN / SQUARE_SIDE;
};
#endif // GAME_H