[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 |
|
---|
| 12 | class GameGui_GLFW : public GameGui {
|
---|
| 13 | public:
|
---|
[d8cb15e] | 14 | static string s_errorMessage; // Has to be public so that glfw_error_callback can access it
|
---|
| 15 |
|
---|
[1ce9afe] | 16 | // Both have to be public so that glfw_key_callback can access them
|
---|
| 17 | // TODO: Implement a more generic public api over this to get the key state
|
---|
[7bf5433] | 18 | static int s_keyState[GLFW_KEY_LAST];
|
---|
| 19 | static bool s_keyDown[GLFW_KEY_LAST];
|
---|
[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 | /*
|
---|
| 30 | void processEvents();
|
---|
| 31 |
|
---|
| 32 | unsigned char getKeyEvent(unsigned int key);
|
---|
| 33 | bool isKeyPressed(unsigned int key);
|
---|
| 34 |
|
---|
| 35 | int pollMouseEvent(MouseEvent* event);
|
---|
| 36 | */
|
---|
| 37 |
|
---|
[4eb4d0a] | 38 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
[7fc5e27] | 39 | bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface);
|
---|
[4eb4d0a] | 40 | #endif
|
---|
| 41 |
|
---|
[7fc5e27] | 42 | vector<const char*> getRequiredExtensions();
|
---|
| 43 | void getWindowSize(int* width, int* height);
|
---|
[0e6ecf3] | 44 |
|
---|
| 45 | private:
|
---|
| 46 | GLFWwindow* window;
|
---|
[7fc5e27] | 47 |
|
---|
| 48 | int windowWidth, windowHeight;
|
---|
[f6521fb] | 49 | static queue<UIEvent> s_events;
|
---|
[0e6ecf3] | 50 | };
|
---|
| 51 |
|
---|
[d8cb15e] | 52 | void glfw_error_callback(int error, const char* description);
|
---|
[7bf5433] | 53 | void glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
|
---|
[1ce9afe] | 54 | void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
---|
[d8cb15e] | 55 |
|
---|
[0e6ecf3] | 56 | #endif // _GAME_GUI_GLFW_H |
---|