feature/imgui-sdl
points-test
Last change
on this file since 3de31cf 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
|
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,
|
---|
[f6521fb] | 17 | UI_EVENT_KEY,
|
---|
| 18 | UI_EVENT_MOUSEBUTTONDOWN,
|
---|
| 19 | UI_EVENT_MOUSEBUTTONUP,
|
---|
[a0da009] | 20 | UI_EVENT_MOUSEMOTION,
|
---|
| 21 | UI_EVENT_UNKNOWN
|
---|
[f6521fb] | 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;
|
---|
[a0da009] | 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;
|
---|
[f6521fb] | 46 | };
|
---|
| 47 |
|
---|
| 48 | union UIEvent {
|
---|
| 49 | EventType type;
|
---|
| 50 | WindowEvent window;
|
---|
| 51 | KeyEvent key;
|
---|
| 52 | MouseEvent mouse;
|
---|
[a0da009] | 53 | UnknownEvent unknown;
|
---|
[f6521fb] | 54 | };
|
---|
| 55 |
|
---|
[f898c5f] | 56 | class GameGui {
|
---|
| 57 | public:
|
---|
[98f3232] | 58 | virtual ~GameGui() {};
|
---|
| 59 |
|
---|
[7fc5e27] | 60 | virtual string& getError() = 0;
|
---|
[d5f2b42] | 61 |
|
---|
[7fc5e27] | 62 | virtual bool init() = 0;
|
---|
| 63 | virtual void shutdown() = 0;
|
---|
[0e6ecf3] | 64 |
|
---|
[7fc5e27] | 65 | virtual void* createWindow(const string& title, int width, int height, bool fullscreen) = 0;
|
---|
| 66 | virtual void destroyWindow() = 0;
|
---|
[0e6ecf3] | 67 |
|
---|
[f6521fb] | 68 | virtual void processEvents() = 0;
|
---|
| 69 | virtual int pollEvent(UIEvent* event) = 0;
|
---|
| 70 |
|
---|
[a6f6833] | 71 | virtual void refreshWindowSize() = 0;
|
---|
| 72 | virtual int getWindowWidth() = 0;
|
---|
| 73 | virtual int getWindowHeight() = 0;
|
---|
[27c40ce] | 74 |
|
---|
[4eb4d0a] | 75 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
[7fc5e27] | 76 | virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
|
---|
| 77 | virtual vector<const char*> getRequiredExtensions() = 0;
|
---|
[a6f6833] | 78 | #endif
|
---|
[0e6ecf3] | 79 | };
|
---|
| 80 |
|
---|
[27c40ce] | 81 | #endif // _GAME_GUI_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.