-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamescene.h
48 lines (40 loc) · 934 Bytes
/
gamescene.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
#ifndef GAMESCENE_H
#define GAMESCENE_H
#include <QGraphicsScene>
#include <QPixmap>
#include <QVector>
#include "game.h"
#include "line.h"
#include "quad.h"
#include "caranim.h"
class QTimer;
class GameScene : public QGraphicsScene
{
Q_OBJECT
public:
explicit GameScene(QObject *parent = nullptr);
signals:
private slots:
void update();
private:
void loadPixmap();
void renderScene();
Game m_game;
QPixmap m_pixmaps[7];
QPixmap m_bgPixmap;
QVector<Line> m_lines;
Quad m_quad;
QTimer *m_timer;
bool m_rightMove, m_leftMove, m_upMove, m_downMove, m_speedUp, m_speedDown, m_accelerate;
int m_N;
float m_playerX;
int m_pos;
int m_H;
int m_startPos;
CarAnim* m_carAnim;
// QGraphicsScene interface
protected:
virtual void keyPressEvent(QKeyEvent *event) override;
virtual void keyReleaseEvent(QKeyEvent *event) override;
};
#endif // GAMESCENE_H