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 | class GameGui_GLFW : public GameGui {
|
---|
13 | public:
|
---|
14 | static string s_errorMessage; // Has to be public so that glfw_error_callback can access it
|
---|
15 |
|
---|
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
|
---|
18 | static int s_keyState[GLFW_KEY_LAST];
|
---|
19 | static bool s_keyDown[GLFW_KEY_LAST];
|
---|
20 |
|
---|
21 | string& getError();
|
---|
22 |
|
---|
23 | bool init();
|
---|
24 | void shutdown();
|
---|
25 |
|
---|
26 | void* createWindow(const string& title, int width, int height, bool fullscreen);
|
---|
27 | void destroyWindow();
|
---|
28 |
|
---|
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 |
|
---|
38 | #ifdef GAMEGUI_INCLUDE_VULKAN
|
---|
39 | bool createVulkanSurface(VkInstance instance, VkSurfaceKHR* surface);
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | vector<const char*> getRequiredExtensions();
|
---|
43 | void getWindowSize(int* width, int* height);
|
---|
44 |
|
---|
45 | private:
|
---|
46 | GLFWwindow* window;
|
---|
47 |
|
---|
48 | int windowWidth, windowHeight;
|
---|
49 | static queue<UIEvent> s_events;
|
---|
50 | };
|
---|
51 |
|
---|
52 | void glfw_error_callback(int error, const char* description);
|
---|
53 | void glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods);
|
---|
54 | void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
---|
55 |
|
---|
56 | #endif // _GAME_GUI_GLFW_H |
---|