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

feature/imgui-sdl points-test
Last change on this file since cb01aff 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
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
10#endif
11
[0e6ecf3]12#include <GLFW/glfw3.h>
13
14class GameGui_GLFW : public GameGui {
15 public:
[d8cb15e]16 static string s_errorMessage; // Has to be public so that glfw_error_callback can access it
17
[c61323a]18 // Has to be public so that glfw_key_callback can access it
19 static queue<UIEvent> s_events;
[1ce9afe]20
[7fc5e27]21 string& getError();
[1ce9afe]22
[7fc5e27]23 bool init();
24 void shutdown();
[0e6ecf3]25
[7fc5e27]26 void* createWindow(const string& title, int width, int height, bool fullscreen);
27 void destroyWindow();
[0e6ecf3]28
[7bf5433]29 void processEvents();
[c61323a]30 int pollEvent(UIEvent* event);
[7bf5433]31
[4eb4d0a]32#ifdef GAMEGUI_INCLUDE_VULKAN
[7fc5e27]33 bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface);
[4eb4d0a]34#endif
35
[7fc5e27]36 vector<const char*> getRequiredExtensions();
37 void getWindowSize(int* width, int* height);
[0e6ecf3]38
39 private:
40 GLFWwindow* window;
[7fc5e27]41
42 int windowWidth, windowHeight;
[0e6ecf3]43};
44
[d8cb15e]45void glfw_error_callback(int error, const char* description);
[7bf5433]46void glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
[1ce9afe]47void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
[d8cb15e]48
[0e6ecf3]49#endif // _GAME_GUI_GLFW_H
Note: See TracBrowser for help on using the repository browser.