source: opengl-game/game-gui-glfw.hpp@ c559904

feature/imgui-sdl points-test
Last change on this file since c559904 was c61323a, checked in by Dmitry Portnoy <dmp1488@…>, 5 years ago

Implement processEvents() and pollEvent() for GameGui_GLFW and re-implement the main loop in opengl-game using those functions

  • Property mode set to 100644
File size: 1.2 KB
Line 
1#ifndef _GAME_GUI_GLFW_H
2#define _GAME_GUI_GLFW_H
3
4#include <queue>
5
6#include "game-gui.hpp"
7
8#ifdef GAMEGUI_INCLUDE_VULKAN
9 #define GLFW_INCLUDE_VULKAN
10#endif
11
12#include <GLFW/glfw3.h>
13
14class GameGui_GLFW : public GameGui {
15 public:
16 static string s_errorMessage; // Has to be public so that glfw_error_callback can access it
17
18 // Has to be public so that glfw_key_callback can access it
19 static queue<UIEvent> s_events;
20
21 string& getError();
22
23 bool init();
24 void shutdown();
25
26 void* createWindow(const string& title, int width, int height, bool fullscreen);
27 void destroyWindow();
28
29 void processEvents();
30 int pollEvent(UIEvent* event);
31
32#ifdef GAMEGUI_INCLUDE_VULKAN
33 bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface);
34#endif
35
36 vector<const char*> getRequiredExtensions();
37 void getWindowSize(int* width, int* height);
38
39 private:
40 GLFWwindow* window;
41
42 int windowWidth, windowHeight;
43};
44
45void glfw_error_callback(int error, const char* description);
46void glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
47void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
48
49#endif // _GAME_GUI_GLFW_H
Note: See TracBrowser for help on using the repository browser.