feature/imgui-sdl
points-test
|
Last change
on this file since 502bd0b was a6f6833, checked in by Dmitry Portnoy <dmp1488@…>, 6 years ago |
|
Remove getWindowSize() from game-gui and instead add getWindowWidth(), getWindowHeight(), and refreshWindowSize() (which updates the internal variables returned by the first two functions)
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | #ifndef _GAME_GUI_H
|
|---|
| 2 | #define _GAME_GUI_H
|
|---|
| 3 |
|
|---|
| 4 | #include <string>
|
|---|
| 5 | #include <vector>
|
|---|
| 6 |
|
|---|
| 7 | // TODO: Remove the line below once the couts in the game-gui-* files are moved
|
|---|
| 8 | #include <iostream>
|
|---|
| 9 |
|
|---|
| 10 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
|---|
| 11 | #include <vulkan/vulkan.h>
|
|---|
| 12 | #endif
|
|---|
| 13 |
|
|---|
| 14 | using namespace std;
|
|---|
| 15 |
|
|---|
| 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 |
|
|---|
| 45 | /*
|
|---|
| 46 | struct MouseEvent {
|
|---|
| 47 | int button;
|
|---|
| 48 | int action;
|
|---|
| 49 | int x;
|
|---|
| 50 | int y;
|
|---|
| 51 | };
|
|---|
| 52 | */
|
|---|
| 53 |
|
|---|
| 54 | class GameGui {
|
|---|
| 55 | public:
|
|---|
| 56 | virtual ~GameGui() {};
|
|---|
| 57 |
|
|---|
| 58 | virtual string& getError() = 0;
|
|---|
| 59 |
|
|---|
| 60 | virtual bool init() = 0;
|
|---|
| 61 | virtual void shutdown() = 0;
|
|---|
| 62 |
|
|---|
| 63 | virtual void* createWindow(const string& title, int width, int height, bool fullscreen) = 0;
|
|---|
| 64 | virtual void destroyWindow() = 0;
|
|---|
| 65 |
|
|---|
| 66 | virtual void processEvents() = 0;
|
|---|
| 67 | virtual int pollEvent(UIEvent* event) = 0;
|
|---|
| 68 |
|
|---|
| 69 | virtual void refreshWindowSize() = 0;
|
|---|
| 70 | virtual int getWindowWidth() = 0;
|
|---|
| 71 | virtual int getWindowHeight() = 0;
|
|---|
| 72 |
|
|---|
| 73 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
|---|
| 74 | virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
|
|---|
| 75 | virtual vector<const char*> getRequiredExtensions() = 0;
|
|---|
| 76 | #endif
|
|---|
| 77 | };
|
|---|
| 78 |
|
|---|
| 79 | #endif // _GAME_GUI_H
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.