forked from qiny1012/Tetris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyscene.h
49 lines (45 loc) · 1.29 KB
/
myscene.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
#ifndef MYSCENE_H
#define MYSCENE_H
#include <QGraphicsScene>
#include "myitem.h"
#include <QDebug>
#include <QList>
#include <QMessageBox>
#include <QTimer>
#include <QVector>
#include <QKeyEvent>
#include <QTime>
#include <QtGlobal>
#include "mygroup.h"
#include <QMessageBox>
class MyScene : public QGraphicsScene
{
Q_OBJECT
public:
QGraphicsLineItem * lineItem1;
QGraphicsLineItem * lineItem2;
QGraphicsLineItem * lineItem3;
QTimer *timer;
MyGroup * curGroup;
MyGroup * nextGroup;
QGraphicsItem * type_ret[20][10];
int score;
int testEnd;
public:
explicit MyScene(QObject *parent = 0);
void initScene();
int IsColliding(); //return 1 yes return 0 no
void keyPressEvent(QKeyEvent * keyEvent);
void addGroup(MyGroup * group);
void creatNewGroup(); //产生一个方块组并且放在场景中
void setRet(); //方块放置完成记录方块。
int testRet(int row); //如果有放置之后要检测这一行是不是已经数据完成了,如果成功放回1,否则0
int destroyFromRet(int row); //把row行的数据删除,然后再把数据全部向下移动
int moveDownRet(int row);
void strat();
void stop();
void starNewGame();
public slots:
int moveDownTest(); //return 1 is over;
};
#endif // MYSCENE_H