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

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

In vulkangame, detect when the framebuffer is resized

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