forked from aspel/pobfrontend
-
Notifications
You must be signed in to change notification settings - Fork 3
/
pobwindow.hpp
86 lines (76 loc) · 2.42 KB
/
pobwindow.hpp
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
#include <QCache>
#include <QDir>
#include <QOpenGLWindow>
#include <QPainter>
#include <memory>
#include "main.h"
#include "subscript.hpp"
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#include "luajit.h"
}
class POBWindow : public QOpenGLWindow {
Q_OBJECT
public:
// POBWindow(QWindow *parent = 0) : QOpenGLWindow(parent) {};
POBWindow() : stringCache(5) {
// QSurfaceFormat theformat(format());
// format.setProfile(QSurfaceFormat::CompatibilityProfile);
/* format.setDepthBufferSize(24);
format.setStencilBufferSize(0);
format.setGreenBufferSize(8);
format.setRedBufferSize(8);
format.setBlueBufferSize(8);*/
// theformat.setAlphaBufferSize(8);
// std::cout << theformat.hasAlpha() << std::endl;
// setFormat(theformat);
scriptPath = QDir::currentPath();
scriptWorkDir = QDir::currentPath();
basePath = QDir::currentPath();
userPath = QDir::currentPath();
fontFudge = 0;
}
// POBWindow() : QOpenGLWindow() {
// };
// ~POBWindow() {};
//protected:
void initializeGL();
void resizeGL(int w, int h);
void paintGL();
void subScriptFinished();
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
void LAssert(lua_State* L, int cond, const char* fmt, ...);
int IsUserData(lua_State* L, int index, const char* metaName);
void SetDrawLayer(int layer);
void SetDrawLayer(int layer, int subLayer);
void SetDrawSubLayer(int subLayer) {
SetDrawLayer(curLayer, subLayer);
}
void AppendCmd(std::shared_ptr<Cmd> cmd);
void DrawColor(const float col[4] = NULL);
void DrawColor(uint32_t col);
QString scriptPath;
QString scriptWorkDir;
QString basePath;
QString userPath;
int curLayer;
int curSubLayer;
int fontFudge;
int width;
int height;
bool isDrawing;
QString fontName;
float drawColor[4];
QMap<QPair<int, int>, QList<std::shared_ptr<Cmd>>> layers;
QList<std::shared_ptr<SubScript>> subScriptList;
std::shared_ptr<QOpenGLTexture> white;
QCache<QString, std::shared_ptr<QOpenGLTexture>> stringCache;
};