-
Notifications
You must be signed in to change notification settings - Fork 114
/
glcanvas.h
129 lines (110 loc) · 3.25 KB
/
glcanvas.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#ifndef GLCANVAS_H
#define GLCANVAS_H
#include <QOpenGLWidget>
#include <QDir>
class LuaApplication;
class Server;
#include "errordialog.h"
#include "orientation.h"
#include "platform.h"
#include <gfile.h>
#include <gfile_p.h>
#include <gstatus.h>
class GLCanvas : public QOpenGLWidget{
Q_OBJECT
public:
GLCanvas(QWidget *parent);
void setupCanvas();
~GLCanvas();
QString projectDir_;
void setHardwareOrientation(Orientation orientation);
void setResolution(int width, int height, bool event);
void setFps(int fps);
void setDrawInfos(bool drawInfos);
void setScale(float scale);
void setCanvasColor(float canvasColor[3]);
void setInfoColor(float infoColor[3]);
void setExportedApp(bool exportedApp);
void printToOutput(const char* text);
void sendRun();
Orientation getHardwareOrientation();
void play(QDir directory);
void play(QString gapp);
//std::set<std::string> accessedResourceFiles;
std::set<std::string> allResourceFiles;
static QString appPackage;
static bool EnableVSYNC;
static bool TabletActive;
static bool TabletPress;
private slots:
void onTimer();
private:
LuaApplication* application_;
Server* server_;
ErrorDialog errorDialog_;
QDir dir_;
Orientation orientation_;
int width_, height_;
bool isPlayer_;
std::string resourceDirectory_;
std::string documentsDirectory_;
std::string temporaryDirectory_;
std::string md5filename_;
int sync_;
double clock_;
QString projectName_;
bool running_;
std::map<std::string, std::vector<unsigned char> > md5_;
float scale_;
float deviceScale_;
bool drawInfos_;
float canvasColor_[3];
float infoColor_[3];
bool exportedApp_;
bool mouseButtonPressed_[5];
QMap<int,int> touchIdMap;
quint32 touchIdUsed;
// PlatformImplementation* platformImplementation_;
void setupProperties();
void setupApplicationProperties();
virtual void initializeGL();
virtual void paintGL();
bool checkLuaError(GStatus status);
void timerEvent(QTimerEvent *);
void mousePressEvent(QMouseEvent* event);
void mouseMoveEvent(QMouseEvent* event);
void mouseReleaseEvent(QMouseEvent* event);
void wheelEvent(QWheelEvent* event);
void keyPressEvent(QKeyEvent* event);
void keyReleaseEvent(QKeyEvent* event);
void tabletEvent(QTabletEvent* event);
virtual bool event(QEvent *event);
void deleteFiles();
void sendFileList();
void loadMD5();
void saveMD5();
void calculateMD5(const char* file);
void printMD5();
void loadProperties(std::vector<char> data);
void loadFiles(std::vector<char> data);
void playLoadedFiles(std::vector<std::string> luafiles);
//static void accessFileCallback_s(FileType type, const char* filename, void* data);
//void accessFileCallback(FileType type, const char* filename);
signals:
void projectNameChanged(const QString& projectName);
};
#endif // GLCANVAS_H
/*
class PlatformImplementation : public PlatformInterface
{
public:
PlatformImplementation(LuaApplication* application) : application_(application) {}
virtual void openUrl(const char* url);
virtual void memoryWarning();
void openUrls();
private:
QTimer* timer_;
std::vector<QUrl> urls_;
LuaApplication* application_;
};
*/