source:
opengl-game/game-gui.hpp@
fe5c3ba
Last change on this file since fe5c3ba was a6f6833, checked in by , 5 years ago | |
---|---|
|
|
File size: 1.5 KB |
Rev | Line | |
---|---|---|
[0e6ecf3] | 1 | #ifndef _GAME_GUI_H |
2 | #define _GAME_GUI_H | |
3 | ||
[9546928] | 4 | #include <string> |
5 | #include <vector> | |
6 | ||
[f6521fb] | 7 | // TODO: Remove the line below once the couts in the game-gui-* files are moved |
8 | #include <iostream> | |
9 | ||
[4eb4d0a] | 10 | #ifdef GAMEGUI_INCLUDE_VULKAN |
11 | #include <vulkan/vulkan.h> | |
12 | #endif | |
[0e6ecf3] | 13 | |
14 | using namespace std; | |
15 | ||
[f6521fb] | 16 | enum EventType { |
17 | UI_EVENT_QUIT, | |
18 | UI_EVENT_WINDOW, | |
19 | UI_EVENT_KEY, | |
20 | UI_EVENT_MOUSEBUTTONDOWN, | |
21 | UI_EVENT_MOUSEBUTTONUP, | |
22 | UI_EVENT_MOUSEMOTION | |
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 | ||
38 | union UIEvent { | |
39 | EventType type; | |
40 | WindowEvent window; | |
41 | KeyEvent key; | |
42 | MouseEvent mouse; | |
43 | }; | |
44 | ||
[27c40ce] | 45 | /* |
46 | struct MouseEvent { | |
47 | int button; | |
48 | int action; | |
49 | int x; | |
50 | int y; | |
51 | }; | |
52 | */ | |
53 | ||
[f898c5f] | 54 | class GameGui { |
55 | public: | |
[98f3232] | 56 | virtual ~GameGui() {}; |
57 | ||
[7fc5e27] | 58 | virtual string& getError() = 0; |
[d5f2b42] | 59 | |
[7fc5e27] | 60 | virtual bool init() = 0; |
61 | virtual void shutdown() = 0; | |
[0e6ecf3] | 62 | |
[7fc5e27] | 63 | virtual void* createWindow(const string& title, int width, int height, bool fullscreen) = 0; |
64 | virtual void destroyWindow() = 0; | |
[0e6ecf3] | 65 | |
[f6521fb] | 66 | virtual void processEvents() = 0; |
67 | virtual int pollEvent(UIEvent* event) = 0; | |
68 | ||
[a6f6833] | 69 | virtual void refreshWindowSize() = 0; |
70 | virtual int getWindowWidth() = 0; | |
71 | virtual int getWindowHeight() = 0; | |
[27c40ce] | 72 | |
[4eb4d0a] | 73 | #ifdef GAMEGUI_INCLUDE_VULKAN |
[7fc5e27] | 74 | virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0; |
75 | virtual vector<const char*> getRequiredExtensions() = 0; | |
[a6f6833] | 76 | #endif |
[0e6ecf3] | 77 | }; |
78 | ||
[27c40ce] | 79 | #endif // _GAME_GUI_H |
Note:
See TracBrowser
for help on using the repository browser.