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

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

In VulkanGame, make the ship move when the player holds down the right or left arrow keys

  • Property mode set to 100644
File size: 1.7 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;
[cd1cb0f]78 virtual bool keyPressed(unsigned int key) = 0;
[f6521fb]79
[a6f6833]80 virtual void refreshWindowSize() = 0;
81 virtual int getWindowWidth() = 0;
82 virtual int getWindowHeight() = 0;
[27c40ce]83
[4eb4d0a]84#ifdef GAMEGUI_INCLUDE_VULKAN
[7fc5e27]85 virtual bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface) = 0;
86 virtual vector<const char*> getRequiredExtensions() = 0;
[a6f6833]87#endif
[0e6ecf3]88};
89
[27c40ce]90#endif // _GAME_GUI_H
Note: See TracBrowser for help on using the repository browser.