-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamemanager.h
76 lines (68 loc) · 1.81 KB
/
gamemanager.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
70
71
72
73
74
75
76
#ifndef GAMEMANAGER_H
#define GAMEMANAGER_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QElapsedTimer>
#include <QMatrix4x4>
#include <QQuaternion>
#include <QVector2D>
#include <QBasicTimer>
#include <QOpenGLShaderProgram>
#include <QOpenGLTexture>
#include <QTime>
#include <QtUiTools/QUiLoader>
#include "camera.h"
#include "lightsource.h"
#include "room.h"
#include "player.h"
#include "uiobject.h"
class GameManager : public QOpenGLWidget, protected QOpenGLFunctions
{
Q_OBJECT
public:
QElapsedTimer et;
QTime m_time;
int m_frameCount;
int max_fps;
int shader = 0;
float x = -137;//move this to a camera
float y = -82;
float z = -25.0;
explicit GameManager(QWidget *parent = 0,int maxfps=60);
~GameManager() override;
int transX;
int transY;
bool walkDown;
bool walkUp;
bool walkLeft;
bool walkRight;
std::vector<UiObject*> UI;
QVector2D mousePressPosition;
QVector3D rotationAxis;
qreal angularSpeed;
QQuaternion rotation;
Player* getPlayer();
protected:
void mousePressEvent(QMouseEvent *e) override;//input manager
void mouseReleaseEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
void timerEvent(QTimerEvent *e) override;
void keyPressEvent ( QKeyEvent * event ) override;
void keyReleaseEvent ( QKeyEvent * event ) override;
void initializeGL() override;
void resizeGL(int w, int h) override;
void paintGL() override;
void initShaders();
void initTextures();
private:
QBasicTimer timer;
QOpenGLShaderProgram program;
QOpenGLShaderProgram uiprogram;
QOpenGLTexture *texture;
std::vector<Room*> scene;
std::vector<LightSource*> lights;
Player *player;
Camera* camera;
QMatrix4x4 projection;
};
#endif // GAMEMANAGER_H