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

feature/imgui-sdl
Last change on this file was a0da009, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 3 years ago

Add a window resize callback in gamegui and add an unknown event type for events that aren't currently handeld

  • Property mode set to 100644
File size: 1.4 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#else
11 #include <GL/glew.h>
12#endif
13
14#include <GLFW/glfw3.h>
15
16class GameGui_GLFW : public GameGui {
17 public:
18 static string s_errorMessage; // Has to be public so that glfw_error_callback can access it
19
20 // Has to be public so that glfw_key_callback can access it
21 static queue<UIEvent> s_events;
22
23 string& getError();
24
25 bool init();
26 void shutdown();
27
28 void* createWindow(const string& title, int width, int height, bool fullscreen);
29 void destroyWindow();
30
31 void bindEventHandlers();
32 void processEvents();
33 int pollEvent(UIEvent* event);
34
35 void refreshWindowSize();
36 int getWindowWidth();
37 int getWindowHeight();
38
39#ifdef GAMEGUI_INCLUDE_VULKAN
40 bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface);
41 vector<const char*> getRequiredExtensions();
42#endif
43
44 private:
45 GLFWwindow* window;
46 int windowWidth, windowHeight;
47};
48
49void glfw_error_callback(int error, const char* description);
50void glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
51void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
52void glfw_window_size_callback(GLFWwindow* window, int width, int height);
53
54#endif // _GAME_GUI_GLFW_H
Note: See TracBrowser for help on using the repository browser.