source: opengl-game/game-gui.hpp@ 5ab1b20

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