source: opengl-game/game-gui.hpp@ 0ecab17

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