feature/imgui-sdl
points-test
Last change
on this file since f6521fb was f6521fb, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago |
Add processEvents() and pollEvent() to GameGui, implement them for GameGui_SDL, and add a union for different event types, similar to the SDL_Event union
|
-
Property mode
set to
100644
|
File size:
1.6 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 |
|
---|
[27c40ce] | 69 | /*
|
---|
| 70 | virtual void processEvents() = 0;
|
---|
| 71 |
|
---|
| 72 | virtual int pollMouseEvent(MouseEvent* event) = 0;
|
---|
| 73 |
|
---|
| 74 | virtual unsigned char getKeyEvent(unsigned int key) = 0;
|
---|
| 75 | virtual bool isKeyPressed(unsigned int key) = 0;
|
---|
| 76 | */
|
---|
| 77 |
|
---|
[4eb4d0a] | 78 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
[7fc5e27] | 79 | virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
|
---|
[4eb4d0a] | 80 | #endif
|
---|
| 81 |
|
---|
[7fc5e27] | 82 | virtual vector<const char*> getRequiredExtensions() = 0;
|
---|
| 83 | virtual void getWindowSize(int* width, int* height) = 0;
|
---|
[0e6ecf3] | 84 | };
|
---|
| 85 |
|
---|
[27c40ce] | 86 | #endif // _GAME_GUI_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.