-
Notifications
You must be signed in to change notification settings - Fork 0
/
tetrisboard.h
69 lines (51 loc) · 1.46 KB
/
tetrisboard.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef TETRISBOARD_H
#define TETRISBOARD_H
#include <QBasicTimer>
#include <QFrame>
#include <QPointer>
#include <QGesture>
#include "tetrispiece.h"
class QLabel;
class TetrisBoard: public QFrame
{
Q_OBJECT
public:
TetrisBoard(QWidget *parent = 0);
float Get_Spm() const;
public slots:
void start();
signals:
void score_changed(int Score);
void lines_changed(int Lines);
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE Q_DECL_FINAL;
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE Q_DECL_FINAL;
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE Q_DECL_FINAL;
bool event(QEvent *event);
bool gestureEvent(QGestureEvent *event);
void swipeTriggered(QSwipeGesture *gesture);
QSize minimumSizeHint() const Q_DECL_OVERRIDE Q_DECL_FINAL;
QSize frameSize() const ;
QSize maximumSize() const;
private:
QBasicTimer timer;
TetrisPiece current_piece;
vector< vector<int> > board; //begint links boven te tellen
bool started;
bool after_block;
int lines;
int score;
int keystrokes;
float spm;
int move_piece(int offset_x, int offset_y);
int gravity();
int rotate();
void new_piece();
void store_piece_in_play();
void erase_piece_in_play();
void delete_line(int line);
int delete_lines();
bool upper_line_check();
int legal_place();
};
#endif // TETRISBOARD_H