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

feature/imgui-sdl points-test
Last change on this file since a0da009 was a0da009, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 years ago

Add a window resize callback in gamegui and add an unknown event type for events that aren't currently handeld

  • 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#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_KEY,
18 UI_EVENT_MOUSEBUTTONDOWN,
19 UI_EVENT_MOUSEBUTTONUP,
20 UI_EVENT_MOUSEMOTION,
21 UI_EVENT_UNKNOWN
22};
23
24struct WindowEvent {
25 EventType type;
26};
27
28struct KeyEvent {
29 EventType type;
30 unsigned int keycode;
31};
32
33struct MouseEvent {
34 EventType type;
35 /*
36 int button;
37 int action;
38 int x;
39 int y;
40 */
41};
42
43struct UnknownEvent {
44 EventType type;
45 unsigned int eventType;
46};
47
48union UIEvent {
49 EventType type;
50 WindowEvent window;
51 KeyEvent key;
52 MouseEvent mouse;
53 UnknownEvent unknown;
54};
55
56class GameGui {
57 public:
58 virtual ~GameGui() {};
59
60 virtual string& getError() = 0;
61
62 virtual bool init() = 0;
63 virtual void shutdown() = 0;
64
65 virtual void* createWindow(const string& title, int width, int height, bool fullscreen) = 0;
66 virtual void destroyWindow() = 0;
67
68 virtual void processEvents() = 0;
69 virtual int pollEvent(UIEvent* event) = 0;
70
71 virtual void refreshWindowSize() = 0;
72 virtual int getWindowWidth() = 0;
73 virtual int getWindowHeight() = 0;
74
75#ifdef GAMEGUI_INCLUDE_VULKAN
76 virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
77 virtual vector<const char*> getRequiredExtensions() = 0;
78#endif
79};
80
81#endif // _GAME_GUI_H
Note: See TracBrowser for help on using the repository browser.