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

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

Add processEvents() and pollEvent() to GameGui, implement them for GameGui_SDL, and add a union for different event types, similar to the SDL_Event union

  • 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// 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
14using namespace std;
15
16enum 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
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
38union UIEvent {
39 EventType type;
40 WindowEvent window;
41 KeyEvent key;
42 MouseEvent mouse;
43};
44
45/*
46struct MouseEvent {
47 int button;
48 int action;
49 int x;
50 int y;
51};
52*/
53
54class 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 /*
70 virtual void processEvents() = 0;
71
72 virtual int pollMouseEvent(MouseEvent* event) = 0;
73
74 virtual unsigned char getKeyEvent(unsigned int key) = 0;
75 virtual bool isKeyPressed(unsigned int key) = 0;
76 */
77
78#ifdef GAMEGUI_INCLUDE_VULKAN
79 virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
80#endif
81
82 virtual vector<const char*> getRequiredExtensions() = 0;
83 virtual void getWindowSize(int* width, int* height) = 0;
84};
85
86#endif // _GAME_GUI_H
Note: See TracBrowser for help on using the repository browser.