blob: 18eeef9e843ecb3847aa9879731162a8def71def (
plain)
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
70
71
72
73
74
75
76
|
#include <qmainwindow.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qpoint.h>
#include <qrect.h>
#include <qtimer.h>
#define MAPSIZE 52
#define BLOCKSIZE 5
#define TRAILSIZE 30
#define STATE_BOSS 0
#define STATE_RUNNING 1
#define STATE_CRASHED 2
#define STATE_NEWGAME 3
class Main : public QMainWindow
{
Q_OBJECT
public:
int sWidth;
int sHeight;
int segSize;
int blockWidth;
int blockHeight;
int state;
int prevState;
int speed;
int crashLineLength;
QPixmap *offscreen;
QTimer *gameTimer;
int score;
int highestScore;
int mapTop[52];
int mapBottom[52];
QRect blocks[5];
QRect user;
QPoint trail[30];
int offset;
int maxHeight;
int nrFrames;
int dir;
bool bossMode;
bool press;
double thrust;
bool running;
Main( int speed = 3, QWidget *p = 0, char *name = 0 );
~Main();
void start();
int nextInt( int range );
void setUp();
bool checkCollision();
void moveLandscape();
void addBlock();
void setPoint( int point );
void drawBoss();
void draw();
void handleKeys();
void keyPressEvent( QKeyEvent *e );
void keyReleaseEvent( QKeyEvent *e );
private slots:
void run();
};
|