-
Notifications
You must be signed in to change notification settings - Fork 2
/
QLive2dWidget.hpp
48 lines (42 loc) · 1.14 KB
/
QLive2dWidget.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
#ifndef QQGLWIDGET_H
#define QQGLWIDGET_H
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QElapsedTimer>
#include <QGuiApplication>
#include <QScreen>
#include <QList>
#include <iostream>
using namespace std;
class QLive2dWidget :
public QOpenGLWidget
{
Q_OBJECT
public:
QLive2dWidget(QWidget *parent = nullptr);
void initializeGL()override;
void resizeGL(int width, int height)override;
void paintGL()override;
void clear();
void setResDir(string resDir);
void setModel(string model);
void mouseMove(QPoint rel);
void mousePress(QPoint rel);
void mouseRelease(QPoint rel);
inline static float ratio;
inline static float ratio_x = 1;
inline static float ratio_y = 1;
inline static QElapsedTimer elapsedTimer;
protected:
void mouseMoveEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
private slots:
void updateMotions();
private:
void calcRatios();
std::string resourceDir = "Resources";
signals:
void initialized(QLive2dWidget *wid);
};
#endif // QLIVE2DWIDGET_H