feature/imgui-sdl
points-test
Last change
on this file since 73a10ca was 0ecab17, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago |
In GameGui_SDL, start setting a flag for key events to indicate repeated events
|
-
Property mode
set to
100644
|
File size:
1.7 KB
|
Rev | Line | |
---|
[0e6ecf3] | 1 | #ifndef _GAME_GUI_H
|
---|
| 2 | #define _GAME_GUI_H
|
---|
| 3 |
|
---|
[9546928] | 4 | #include <string>
|
---|
| 5 | #include <vector>
|
---|
| 6 |
|
---|
[4eb4d0a] | 7 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
| 8 | #include <vulkan/vulkan.h>
|
---|
| 9 | #endif
|
---|
[0e6ecf3] | 10 |
|
---|
| 11 | using namespace std;
|
---|
| 12 |
|
---|
[f6521fb] | 13 | enum EventType {
|
---|
| 14 | UI_EVENT_QUIT,
|
---|
| 15 | UI_EVENT_WINDOW,
|
---|
[0e09340] | 16 | UI_EVENT_WINDOWRESIZE,
|
---|
[5a23277] | 17 | UI_EVENT_KEYDOWN,
|
---|
| 18 | UI_EVENT_KEYUP,
|
---|
[f6521fb] | 19 | UI_EVENT_MOUSEBUTTONDOWN,
|
---|
| 20 | UI_EVENT_MOUSEBUTTONUP,
|
---|
[a0da009] | 21 | UI_EVENT_MOUSEMOTION,
|
---|
| 22 | UI_EVENT_UNKNOWN
|
---|
[f6521fb] | 23 | };
|
---|
| 24 |
|
---|
| 25 | struct WindowEvent {
|
---|
| 26 | EventType type;
|
---|
| 27 | };
|
---|
| 28 |
|
---|
| 29 | struct KeyEvent {
|
---|
| 30 | EventType type;
|
---|
| 31 | unsigned int keycode;
|
---|
[0ecab17] | 32 | bool repeat;
|
---|
[f6521fb] | 33 | };
|
---|
| 34 |
|
---|
| 35 | struct MouseEvent {
|
---|
| 36 | EventType type;
|
---|
[a0da009] | 37 | /*
|
---|
| 38 | int button;
|
---|
| 39 | int action;
|
---|
| 40 | int x;
|
---|
| 41 | int y;
|
---|
| 42 | */
|
---|
| 43 | };
|
---|
| 44 |
|
---|
[83b5b4b] | 45 | struct WindowResizeEvent {
|
---|
| 46 | EventType type;
|
---|
| 47 | int width;
|
---|
| 48 | int height;
|
---|
| 49 | };
|
---|
| 50 |
|
---|
[a0da009] | 51 | struct UnknownEvent {
|
---|
| 52 | EventType type;
|
---|
| 53 | unsigned int eventType;
|
---|
[f6521fb] | 54 | };
|
---|
| 55 |
|
---|
| 56 | union UIEvent {
|
---|
| 57 | EventType type;
|
---|
| 58 | WindowEvent window;
|
---|
| 59 | KeyEvent key;
|
---|
| 60 | MouseEvent mouse;
|
---|
[83b5b4b] | 61 | WindowResizeEvent windowResize;
|
---|
[a0da009] | 62 | UnknownEvent unknown;
|
---|
[f6521fb] | 63 | };
|
---|
| 64 |
|
---|
[f898c5f] | 65 | class GameGui {
|
---|
| 66 | public:
|
---|
[98f3232] | 67 | virtual ~GameGui() {};
|
---|
| 68 |
|
---|
[7fc5e27] | 69 | virtual string& getError() = 0;
|
---|
[d5f2b42] | 70 |
|
---|
[7fc5e27] | 71 | virtual bool init() = 0;
|
---|
| 72 | virtual void shutdown() = 0;
|
---|
[0e6ecf3] | 73 |
|
---|
[7fc5e27] | 74 | virtual void* createWindow(const string& title, int width, int height, bool fullscreen) = 0;
|
---|
| 75 | virtual void destroyWindow() = 0;
|
---|
[0e6ecf3] | 76 |
|
---|
[f6521fb] | 77 | virtual void processEvents() = 0;
|
---|
| 78 | virtual int pollEvent(UIEvent* event) = 0;
|
---|
[cd1cb0f] | 79 | virtual bool keyPressed(unsigned int key) = 0;
|
---|
[f6521fb] | 80 |
|
---|
[a6f6833] | 81 | virtual void refreshWindowSize() = 0;
|
---|
| 82 | virtual int getWindowWidth() = 0;
|
---|
| 83 | virtual int getWindowHeight() = 0;
|
---|
[27c40ce] | 84 |
|
---|
[4eb4d0a] | 85 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
[7fc5e27] | 86 | virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
|
---|
| 87 | virtual vector<const char*> getRequiredExtensions() = 0;
|
---|
[a6f6833] | 88 | #endif
|
---|
[0e6ecf3] | 89 | };
|
---|
| 90 |
|
---|
[27c40ce] | 91 | #endif // _GAME_GUI_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.