feature/imgui-sdl
points-test
Last change
on this file since 2ba5617 was cd1cb0f, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago |
In VulkanGame, make the ship move when the player holds down the right or left arrow keys
|
-
Property mode
set to
100644
|
File size:
1.7 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_KEYDOWN,
|
---|
18 | UI_EVENT_KEYUP,
|
---|
19 | UI_EVENT_MOUSEBUTTONDOWN,
|
---|
20 | UI_EVENT_MOUSEBUTTONUP,
|
---|
21 | UI_EVENT_MOUSEMOTION,
|
---|
22 | UI_EVENT_UNKNOWN
|
---|
23 | };
|
---|
24 |
|
---|
25 | struct WindowEvent {
|
---|
26 | EventType type;
|
---|
27 | };
|
---|
28 |
|
---|
29 | struct KeyEvent {
|
---|
30 | EventType type;
|
---|
31 | unsigned int keycode;
|
---|
32 | };
|
---|
33 |
|
---|
34 | struct MouseEvent {
|
---|
35 | EventType type;
|
---|
36 | /*
|
---|
37 | int button;
|
---|
38 | int action;
|
---|
39 | int x;
|
---|
40 | int y;
|
---|
41 | */
|
---|
42 | };
|
---|
43 |
|
---|
44 | struct WindowResizeEvent {
|
---|
45 | EventType type;
|
---|
46 | int width;
|
---|
47 | int height;
|
---|
48 | };
|
---|
49 |
|
---|
50 | struct UnknownEvent {
|
---|
51 | EventType type;
|
---|
52 | unsigned int eventType;
|
---|
53 | };
|
---|
54 |
|
---|
55 | union UIEvent {
|
---|
56 | EventType type;
|
---|
57 | WindowEvent window;
|
---|
58 | KeyEvent key;
|
---|
59 | MouseEvent mouse;
|
---|
60 | WindowResizeEvent windowResize;
|
---|
61 | UnknownEvent unknown;
|
---|
62 | };
|
---|
63 |
|
---|
64 | class GameGui {
|
---|
65 | public:
|
---|
66 | virtual ~GameGui() {};
|
---|
67 |
|
---|
68 | virtual string& getError() = 0;
|
---|
69 |
|
---|
70 | virtual bool init() = 0;
|
---|
71 | virtual void shutdown() = 0;
|
---|
72 |
|
---|
73 | virtual void* createWindow(const string& title, int width, int height, bool fullscreen) = 0;
|
---|
74 | virtual void destroyWindow() = 0;
|
---|
75 |
|
---|
76 | virtual void processEvents() = 0;
|
---|
77 | virtual int pollEvent(UIEvent* event) = 0;
|
---|
78 | virtual bool keyPressed(unsigned int key) = 0;
|
---|
79 |
|
---|
80 | virtual void refreshWindowSize() = 0;
|
---|
81 | virtual int getWindowWidth() = 0;
|
---|
82 | virtual int getWindowHeight() = 0;
|
---|
83 |
|
---|
84 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
85 | virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
|
---|
86 | virtual vector<const char*> getRequiredExtensions() = 0;
|
---|
87 | #endif
|
---|
88 | };
|
---|
89 |
|
---|
90 | #endif // _GAME_GUI_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.