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
|
Rev | Line | |
---|
[0e6ecf3] | 1 | #ifndef _GAME_GUI_GLFW_H
|
---|
| 2 | #define _GAME_GUI_GLFW_H
|
---|
| 3 |
|
---|
| 4 | #include "game-gui.hpp"
|
---|
| 5 |
|
---|
[4eb4d0a] | 6 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
| 7 | #define GLFW_INCLUDE_VULKAN
|
---|
| 8 | #endif
|
---|
| 9 |
|
---|
[0e6ecf3] | 10 | #include <GLFW/glfw3.h>
|
---|
| 11 |
|
---|
[1ce9afe] | 12 | #define NUM_KEYS (512)
|
---|
| 13 |
|
---|
[0e6ecf3] | 14 | class 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 |
|
---|
[1ce9afe] | 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 |
|
---|
[0e6ecf3] | 25 | bool Init();
|
---|
| 26 | void Shutdown();
|
---|
| 27 |
|
---|
[1ce9afe] | 28 | void* CreateWindow(const string& title, unsigned int width, unsigned int height, bool fullscreen);
|
---|
[0e6ecf3] | 29 | void DestroyWindow();
|
---|
| 30 |
|
---|
[4eb4d0a] | 31 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
[0e6ecf3] | 32 | bool CreateVulkanSurface(VkInstance instance, VkSurfaceKHR* surface);
|
---|
[4eb4d0a] | 33 | #endif
|
---|
| 34 |
|
---|
[8667f76] | 35 | vector<const char*> GetRequiredExtensions();
|
---|
| 36 | void GetWindowSize(int* width, int* height);
|
---|
[0e6ecf3] | 37 |
|
---|
| 38 | private:
|
---|
| 39 | GLFWwindow* window;
|
---|
| 40 | };
|
---|
| 41 |
|
---|
[d8cb15e] | 42 | void glfw_error_callback(int error, const char* description);
|
---|
[1ce9afe] | 43 | void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
---|
[d8cb15e] | 44 |
|
---|
[0e6ecf3] | 45 | #endif // _GAME_GUI_GLFW_H |
---|
Note:
See
TracBrowser
for help on using the repository browser.