feature/imgui-sdl
points-test
Last change
on this file since 7d2b0b9 was a0da009, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago |
Add a window resize callback in gamegui and add an unknown event type for events that aren't currently handeld
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | #ifndef _GAME_GUI_H
|
---|
2 | #define _GAME_GUI_H
|
---|
3 |
|
---|
4 | #include <string>
|
---|
5 | #include <vector>
|
---|
6 |
|
---|
7 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
8 | #include <vulkan/vulkan.h>
|
---|
9 | #endif
|
---|
10 |
|
---|
11 | using namespace std;
|
---|
12 |
|
---|
13 | enum EventType {
|
---|
14 | UI_EVENT_QUIT,
|
---|
15 | UI_EVENT_WINDOW,
|
---|
16 | UI_EVENT_WINDOWRESIZE,
|
---|
17 | UI_EVENT_KEY,
|
---|
18 | UI_EVENT_MOUSEBUTTONDOWN,
|
---|
19 | UI_EVENT_MOUSEBUTTONUP,
|
---|
20 | UI_EVENT_MOUSEMOTION,
|
---|
21 | UI_EVENT_UNKNOWN
|
---|
22 | };
|
---|
23 |
|
---|
24 | struct WindowEvent {
|
---|
25 | EventType type;
|
---|
26 | };
|
---|
27 |
|
---|
28 | struct KeyEvent {
|
---|
29 | EventType type;
|
---|
30 | unsigned int keycode;
|
---|
31 | };
|
---|
32 |
|
---|
33 | struct MouseEvent {
|
---|
34 | EventType type;
|
---|
35 | /*
|
---|
36 | int button;
|
---|
37 | int action;
|
---|
38 | int x;
|
---|
39 | int y;
|
---|
40 | */
|
---|
41 | };
|
---|
42 |
|
---|
43 | struct UnknownEvent {
|
---|
44 | EventType type;
|
---|
45 | unsigned int eventType;
|
---|
46 | };
|
---|
47 |
|
---|
48 | union UIEvent {
|
---|
49 | EventType type;
|
---|
50 | WindowEvent window;
|
---|
51 | KeyEvent key;
|
---|
52 | MouseEvent mouse;
|
---|
53 | UnknownEvent unknown;
|
---|
54 | };
|
---|
55 |
|
---|
56 | class GameGui {
|
---|
57 | public:
|
---|
58 | virtual ~GameGui() {};
|
---|
59 |
|
---|
60 | virtual string& getError() = 0;
|
---|
61 |
|
---|
62 | virtual bool init() = 0;
|
---|
63 | virtual void shutdown() = 0;
|
---|
64 |
|
---|
65 | virtual void* createWindow(const string& title, int width, int height, bool fullscreen) = 0;
|
---|
66 | virtual void destroyWindow() = 0;
|
---|
67 |
|
---|
68 | virtual void processEvents() = 0;
|
---|
69 | virtual int pollEvent(UIEvent* event) = 0;
|
---|
70 |
|
---|
71 | virtual void refreshWindowSize() = 0;
|
---|
72 | virtual int getWindowWidth() = 0;
|
---|
73 | virtual int getWindowHeight() = 0;
|
---|
74 |
|
---|
75 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
76 | virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
|
---|
77 | virtual vector<const char*> getRequiredExtensions() = 0;
|
---|
78 | #endif
|
---|
79 | };
|
---|
80 |
|
---|
81 | #endif // _GAME_GUI_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.