-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgameEngine.h
54 lines (47 loc) · 1.01 KB
/
gameEngine.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
#ifndef GAMEENGINE_H
#define GAMEENGINE_H
#include "Config.h"
#include <QWidget>
#include <QTimer>
#include <QKeyEvent>
#include "server.h"
#include "client.h"
#include "player.h"
#include "map.h"
#include "object.h"
#include "enemy.h"
#include <QRandomGenerator>
QT_BEGIN_NAMESPACE
namespace Ui { class GameEngine; }
QT_END_NAMESPACE
class GameEngine : public QWidget
{
Q_OBJECT
public:
GameEngine(QWidget *parent = nullptr);
~GameEngine();
void Player1(int port);
void Player2(QString ip,QString port);
void StartGame();
void GameInit();
void sameLoop();
private slots:
void GameLoop1();
void GameLoop2();
protected:
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e);
private:
Ui::GameEngine *ui;
QTimer *timer; //游戏主循环
Server *server;
Client *client;
Player *player1;
Player *player2;
Map *map;
Object *tree[TREE_NUM];
Object *gun[3];
Enemy *enemy[ENEMY_NUM];
QPixmap *background;
};
#endif // GAMEENGINE_H