source: opengl-game/game-gui-glfw.hpp@ 0ecab17

feature/imgui-sdl points-test
Last change on this file since 0ecab17 was a0da009, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 5 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
RevLine 
[0e6ecf3]1#ifndef _GAME_GUI_GLFW_H
2#define _GAME_GUI_GLFW_H
3
[c61323a]4#include <queue>
5
[0e6ecf3]6#include "game-gui.hpp"
7
[4eb4d0a]8#ifdef GAMEGUI_INCLUDE_VULKAN
9 #define GLFW_INCLUDE_VULKAN
[a6f6833]10#else
11 #include <GL/glew.h>
[4eb4d0a]12#endif
13
[0e6ecf3]14#include <GLFW/glfw3.h>
15
16class GameGui_GLFW : public GameGui {
17 public:
[d8cb15e]18 static string s_errorMessage; // Has to be public so that glfw_error_callback can access it
19
[c61323a]20 // Has to be public so that glfw_key_callback can access it
21 static queue<UIEvent> s_events;
[1ce9afe]22
[7fc5e27]23 string& getError();
[1ce9afe]24
[7fc5e27]25 bool init();
26 void shutdown();
[0e6ecf3]27
[7fc5e27]28 void* createWindow(const string& title, int width, int height, bool fullscreen);
29 void destroyWindow();
[0e6ecf3]30
[f133da0]31 void bindEventHandlers();
[7bf5433]32 void processEvents();
[c61323a]33 int pollEvent(UIEvent* event);
[7bf5433]34
[a6f6833]35 void refreshWindowSize();
36 int getWindowWidth();
37 int getWindowHeight();
38
[4eb4d0a]39#ifdef GAMEGUI_INCLUDE_VULKAN
[7fc5e27]40 bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface);
41 vector<const char*> getRequiredExtensions();
[a6f6833]42#endif
[0e6ecf3]43
44 private:
45 GLFWwindow* window;
[7fc5e27]46 int windowWidth, windowHeight;
[0e6ecf3]47};
48
[d8cb15e]49void glfw_error_callback(int error, const char* description);
[7bf5433]50void glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
[1ce9afe]51void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
[a0da009]52void glfw_window_size_callback(GLFWwindow* window, int width, int height);
[d8cb15e]53
[0e6ecf3]54#endif // _GAME_GUI_GLFW_H
Note: See TracBrowser for help on using the repository browser.