-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.h
46 lines (35 loc) · 873 Bytes
/
board.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 BOARD_H
#define BOARD_H
#include <QGraphicsScene>
#include <QTimer>
#include "tetris_defs.h"
#include "piece.h"
// Main Platform Scene
class Board : public QGraphicsScene
{
Q_OBJECT
public:
Board(QObject *parent);
~Board();
void start();
void stop();
#ifdef QT_DEBUG
void test(const QString& message);
#endif
private slots:
void update();
private:
QGraphicsLineItem * upBorder;
QGraphicsLineItem * leftBorder;
QGraphicsLineItem * rigthBorder;
QGraphicsLineItem * bottomBorder;
QTimer _timer;
QGraphicsPixmapItem * m_tiles[NUM_W_BLOCK][NUM_H_BLOCK] = {};
Piece * _current_piece = nullptr;
Piece * _next_piece = nullptr;
void keyPressEvent(QKeyEvent * keyEvent);
void newPiece();
void applyAction(Piece::Action act);
void fadeOut(QGraphicsPixmapItem * item);
};
#endif // BOARD_H