source: opengl-game/game-gui-glfw.hpp@ 1ce9afe

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

Add a fullscreen flag to GameGui::CreateWindow and implement fullscreen functionality and the ability to detect key presses in openglgame

  • 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 "game-gui.hpp"
5
6#ifdef GAMEGUI_INCLUDE_VULKAN
7 #define GLFW_INCLUDE_VULKAN
8#endif
9
10#include <GLFW/glfw3.h>
11
12#define NUM_KEYS (512)
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 // Both have to be public so that glfw_key_callback can access them
19 // TODO: Implement a more generic public api over this to get the key state
20 static int s_keyState[NUM_KEYS];
21 static bool s_keyDown[NUM_KEYS];
22
23 string& GetError();
24
25 bool Init();
26 void Shutdown();
27
28 void* CreateWindow(const string& title, unsigned int width, unsigned int height, bool fullscreen);
29 void DestroyWindow();
30
31#ifdef GAMEGUI_INCLUDE_VULKAN
32 bool CreateVulkanSurface(VkInstance instance, VkSurfaceKHR* surface);
33#endif
34
35 vector<const char*> GetRequiredExtensions();
36 void GetWindowSize(int* width, int* height);
37
38 private:
39 GLFWwindow* window;
40};
41
42void glfw_error_callback(int error, const char* description);
43void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
44
45#endif // _GAME_GUI_GLFW_H
Note: See TracBrowser for help on using the repository browser.