source: opengl-game/game-gui.hpp@ e3bef3a

feature/imgui-sdl points-test
Last change on this file since e3bef3a was 5a23277, checked in by Dmitry Portnoy <dmp1488@…>, 5 years ago

Replace the key event in game-gui with distinct key up and key down events

  • Property mode set to 100644
File size: 1.6 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};
33
34struct MouseEvent {
35 EventType type;
36 /*
37 int button;
38 int action;
39 int x;
40 int y;
41 */
42};
43
44struct WindowResizeEvent {
45 EventType type;
46 int width;
47 int height;
48};
49
50struct UnknownEvent {
51 EventType type;
52 unsigned int eventType;
53};
54
55union UIEvent {
56 EventType type;
57 WindowEvent window;
58 KeyEvent key;
59 MouseEvent mouse;
60 WindowResizeEvent windowResize;
61 UnknownEvent unknown;
62};
63
64class GameGui {
65 public:
66 virtual ~GameGui() {};
67
68 virtual string& getError() = 0;
69
70 virtual bool init() = 0;
71 virtual void shutdown() = 0;
72
73 virtual void* createWindow(const string& title, int width, int height, bool fullscreen) = 0;
74 virtual void destroyWindow() = 0;
75
76 virtual void processEvents() = 0;
77 virtual int pollEvent(UIEvent* event) = 0;
78
79 virtual void refreshWindowSize() = 0;
80 virtual int getWindowWidth() = 0;
81 virtual int getWindowHeight() = 0;
82
83#ifdef GAMEGUI_INCLUDE_VULKAN
84 virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
85 virtual vector<const char*> getRequiredExtensions() = 0;
86#endif
87};
88
89#endif // _GAME_GUI_H
Note: See TracBrowser for help on using the repository browser.