summaryrefslogtreecommitdiff
path: root/src/window.h
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-12-11 10:49:50 -0500
committerFreya Murphy <freya@freyacat.org>2025-12-11 10:51:40 -0500
commitfa8fa6784559ed0fc8d780e36880273f77e272c4 (patch)
tree7456a4e9148d47e409ba837bafdc6238b6c757db /src/window.h
parentadd ubos (diff)
downloadvoxel-fa8fa6784559ed0fc8d780e36880273f77e272c4.tar.gz
voxel-fa8fa6784559ed0fc8d780e36880273f77e272c4.tar.bz2
voxel-fa8fa6784559ed0fc8d780e36880273f77e272c4.zip
i did a lot
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);