feature/imgui-sdl
points-test
Last change
on this file since 7563b8a was 0e09340, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago |
In vulkangame, detect when the framebuffer is resized
|
-
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 |
|
---|
[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,
|
---|
[0e09340] | 19 | UI_EVENT_WINDOWRESIZE,
|
---|
[f6521fb] | 20 | UI_EVENT_KEY,
|
---|
| 21 | UI_EVENT_MOUSEBUTTONDOWN,
|
---|
| 22 | UI_EVENT_MOUSEBUTTONUP,
|
---|
| 23 | UI_EVENT_MOUSEMOTION
|
---|
| 24 | };
|
---|
| 25 |
|
---|
| 26 | struct WindowEvent {
|
---|
| 27 | EventType type;
|
---|
| 28 | };
|
---|
| 29 |
|
---|
| 30 | struct KeyEvent {
|
---|
| 31 | EventType type;
|
---|
| 32 | unsigned int keycode;
|
---|
| 33 | };
|
---|
| 34 |
|
---|
| 35 | struct MouseEvent {
|
---|
| 36 | EventType type;
|
---|
| 37 | };
|
---|
| 38 |
|
---|
| 39 | union UIEvent {
|
---|
| 40 | EventType type;
|
---|
| 41 | WindowEvent window;
|
---|
| 42 | KeyEvent key;
|
---|
| 43 | MouseEvent mouse;
|
---|
| 44 | };
|
---|
| 45 |
|
---|
[27c40ce] | 46 | /*
|
---|
| 47 | struct MouseEvent {
|
---|
| 48 | int button;
|
---|
| 49 | int action;
|
---|
| 50 | int x;
|
---|
| 51 | int y;
|
---|
| 52 | };
|
---|
| 53 | */
|
---|
| 54 |
|
---|
[f898c5f] | 55 | class GameGui {
|
---|
| 56 | public:
|
---|
[98f3232] | 57 | virtual ~GameGui() {};
|
---|
| 58 |
|
---|
[7fc5e27] | 59 | virtual string& getError() = 0;
|
---|
[d5f2b42] | 60 |
|
---|
[7fc5e27] | 61 | virtual bool init() = 0;
|
---|
| 62 | virtual void shutdown() = 0;
|
---|
[0e6ecf3] | 63 |
|
---|
[7fc5e27] | 64 | virtual void* createWindow(const string& title, int width, int height, bool fullscreen) = 0;
|
---|
| 65 | virtual void destroyWindow() = 0;
|
---|
[0e6ecf3] | 66 |
|
---|
[f6521fb] | 67 | virtual void processEvents() = 0;
|
---|
| 68 | virtual int pollEvent(UIEvent* event) = 0;
|
---|
| 69 |
|
---|
[a6f6833] | 70 | virtual void refreshWindowSize() = 0;
|
---|
| 71 | virtual int getWindowWidth() = 0;
|
---|
| 72 | virtual int getWindowHeight() = 0;
|
---|
[27c40ce] | 73 |
|
---|
[4eb4d0a] | 74 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
[7fc5e27] | 75 | virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
|
---|
| 76 | virtual vector<const char*> getRequiredExtensions() = 0;
|
---|
[a6f6833] | 77 | #endif
|
---|
[0e6ecf3] | 78 | };
|
---|
| 79 |
|
---|
[27c40ce] | 80 | #endif // _GAME_GUI_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.