diff options
Diffstat (limited to 'src/window.h')
| -rw-r--r-- | src/window.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/window.h b/src/window.h new file mode 100644 index 0000000..3690781 --- /dev/null +++ b/src/window.h @@ -0,0 +1,46 @@ +#pragma once + +#include <GLFW/glfw3.h> + +#define WINDOW_WIDTH 640 +#define WINDOW_HEIGHT 480 +#define WINDOW_TITLE "Voxel Engine" + +typedef struct { + // screen size + int width; + int height; + // input + bool key_down[GLFW_KEY_LAST]; + bool key_pressed[GLFW_KEY_LAST]; + bool btn_down[GLFW_MOUSE_BUTTON_LAST]; + bool btn_pressed[GLFW_MOUSE_BUTTON_LAST]; + // cursor + double mouse_x; + double mouse_y; + double mouse_x_last; + double moues_y_last; + // time + double last_time; + // glfw + GLFWwindow *window; + GLFWmonitor *monitor; +} Window; + +extern Window window; +extern double delta_time; + +int window_init(void); +bool window_closed(void); +void window_update(void); +void window_swap(void); +void window_close(void); + +int window_grab_cursor(void); +int window_release_cursor(void); + +bool key_down(int key); +bool key_pressed(int key); + +bool btn_down(int button); +bool btn_pressed(int button); |