summaryrefslogtreecommitdiff
path: root/src/window.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.h')
-rw-r--r--src/window.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/window.h b/src/window.h
index 3690781..5fc3197 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1,6 +1,9 @@
#pragma once
#include <GLFW/glfw3.h>
+#include <threads.h>
+
+#include "voxel.h"
#define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480
@@ -8,8 +11,8 @@
typedef struct {
// screen size
- int width;
- int height;
+ u32 width;
+ u32 height;
// input
bool key_down[GLFW_KEY_LAST];
bool key_pressed[GLFW_KEY_LAST];
@@ -24,23 +27,25 @@ typedef struct {
double last_time;
// glfw
GLFWwindow *window;
- GLFWmonitor *monitor;
+ // sync
+ mtx_t lock;
+ // flags
+ _Atomic bool close;
+ _Atomic bool resize;
} Window;
extern Window window;
-extern double delta_time;
+extern _Atomic double delta_time;
-int window_init(void);
+VOXEL_RESULT window_init(void);
+VOXEL_RESULT window_init_gl(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 key_down(i32 key);
+bool key_pressed(i32 key);
-bool btn_down(int button);
-bool btn_pressed(int button);
+bool btn_down(i32 button);
+bool btn_pressed(i32 button);