| 1 | #ifndef _GAME_GUI_GLFW_H
|
|---|
| 2 | #define _GAME_GUI_GLFW_H
|
|---|
| 3 |
|
|---|
| 4 | #include <queue>
|
|---|
| 5 |
|
|---|
| 6 | #include "game-gui.hpp"
|
|---|
| 7 |
|
|---|
| 8 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
|---|
| 9 | #define GLFW_INCLUDE_VULKAN
|
|---|
| 10 | #else
|
|---|
| 11 | #include <GL/glew.h>
|
|---|
| 12 | #endif
|
|---|
| 13 |
|
|---|
| 14 | #include <GLFW/glfw3.h>
|
|---|
| 15 |
|
|---|
| 16 | class GameGui_GLFW : public GameGui {
|
|---|
| 17 | public:
|
|---|
| 18 | static string s_errorMessage; // Has to be public so that glfw_error_callback can access it
|
|---|
| 19 |
|
|---|
| 20 | // Has to be public so that glfw_key_callback can access it
|
|---|
| 21 | static queue<UIEvent> s_events;
|
|---|
| 22 |
|
|---|
| 23 | string& getError();
|
|---|
| 24 |
|
|---|
| 25 | bool init();
|
|---|
| 26 | void shutdown();
|
|---|
| 27 |
|
|---|
| 28 | void* createWindow(const string& title, int width, int height, bool fullscreen);
|
|---|
| 29 | void destroyWindow();
|
|---|
| 30 |
|
|---|
| 31 | void bindEventHandlers();
|
|---|
| 32 | void processEvents();
|
|---|
| 33 | int pollEvent(UIEvent* event);
|
|---|
| 34 |
|
|---|
| 35 | void refreshWindowSize();
|
|---|
| 36 | int getWindowWidth();
|
|---|
| 37 | int getWindowHeight();
|
|---|
| 38 |
|
|---|
| 39 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
|---|
| 40 | bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface);
|
|---|
| 41 | vector<const char*> getRequiredExtensions();
|
|---|
| 42 | #endif
|
|---|
| 43 |
|
|---|
| 44 | private:
|
|---|
| 45 | GLFWwindow* window;
|
|---|
| 46 | int windowWidth, windowHeight;
|
|---|
| 47 | };
|
|---|
| 48 |
|
|---|
| 49 | void glfw_error_callback(int error, const char* description);
|
|---|
| 50 | void glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
|
|---|
| 51 | void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
|---|
| 52 | void glfw_window_size_callback(GLFWwindow* window, int width, int height);
|
|---|
| 53 |
|
|---|
| 54 | #endif // _GAME_GUI_GLFW_H
|
|---|