summaryrefslogtreecommitdiff
path: root/src/window.h
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-12-04 13:16:21 -0500
committerFreya Murphy <freya@freyacat.org>2025-12-04 13:18:33 -0500
commitba2f810f0752bdecf8253b34bd245c7939f23534 (patch)
tree23a5fa60afb7f9f5d0ff1b51d11bb8dd24f46e04 /src/window.h
downloadvoxel-ba2f810f0752bdecf8253b34bd245c7939f23534.tar.gz
voxel-ba2f810f0752bdecf8253b34bd245c7939f23534.tar.bz2
voxel-ba2f810f0752bdecf8253b34bd245c7939f23534.zip
initial chunk rendering
Diffstat (limited to 'src/window.h')
-rw-r--r--src/window.h46
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);