-
-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy patheditorplatform.h
More file actions
92 lines (59 loc) · 1.92 KB
/
editorplatform.h
File metadata and controls
92 lines (59 loc) · 1.92 KB
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
#ifndef EDITORPLATFORM_H
#define EDITORPLATFORM_H
#include <QHash>
#include <QSize>
#include <QPoint>
#include <adapters/platformadaptor.h>
#define NONE 0
#define RELEASE 1
#define PRESS 2
#define REPEAT 3
class Engine;
class Camera;
class QKeyEvent;
class ENGINE_EXPORT EditorPlatform : public PlatformAdaptor {
public:
static EditorPlatform &instance();
void setImportPath(const TString &path);
void setScreenSize(const QSize &size);
bool isMouseLocked() const;
void setMousePosition(const QPoint &position);
void setMouseDelta(const QPoint &position);
void setMouseScrollDelta(float delta);
void setMouseButtons(int button, int state);
void setKeys(QKeyEvent *ev, bool release);
void update() override;
void reset();
protected:
EditorPlatform();
bool init() override;
bool start() override { return true; }
void destroy() override {}
bool isActive() const override;
bool key(Input::KeyCode) const override;
bool keyPressed(Input::KeyCode) const override;
bool keyReleased(Input::KeyCode) const override;
TString inputString() const override;
bool mouseButton(int) const override;
bool mousePressed(int) const override;
bool mouseReleased(int) const override;
Vector4 mousePosition() const override;
void mouseLockCursor(bool lock) override;
Vector4 mouseDelta() const override;
float mouseScrollDelta() const override;
uint32_t screenWidth() const override;
uint32_t screenHeight() const override;
TString locationLocalDir() const override;
void syncConfiguration(VariantMap &map) const override;
protected:
QHash<int32_t, int32_t> m_keys;
QHash<int32_t, int32_t> m_mouseButtons;
QSize m_screenSize;
TString m_inputString;
Vector4 m_mouseDelta;
Vector4 m_mousePosition;
float m_mouseScrollDelta;
bool m_mouseLock;
static bool s_appActive;
};
#endif // EDITORPLATFORM_H