From 7e06a916e6a385c37075abcb83d14b8c1fef7bc0 Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 12 Aug 2025 18:41:26 +0200 Subject: feat: camera --- src/core/window.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/core/window.h') diff --git a/src/core/window.h b/src/core/window.h index 8e9778e..d541b54 100644 --- a/src/core/window.h +++ b/src/core/window.h @@ -15,16 +15,24 @@ namespace Donut ~Window(); bool should_close() const; - void on_update() const; + void on_update() const; + + void set_event_callback(const EventCallbackFn& callback) + { + m_event_handler.set_event_callback(callback); + } - void set_event_callback(const EventCallbackFn& callback) { m_event_handler.set_event_callback(callback); } EventHandler& get_event_handler() { return m_event_handler; } - unsigned int get_width() const { return m_width; } + unsigned int get_width() const { return m_width; } unsigned int get_height() const { return m_height; } void* get_native_window() const { return m_window; } + void set_cursor_locked(bool locked); + void set_cursor_visible(bool visible); + bool is_cursor_locked() const { return m_cursor_locked; } + bool is_cursor_visible() const { return m_cursor_visible; } private: void init(); void shutdown(); @@ -39,7 +47,6 @@ namespace Donut static void glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods); static void glfw_mouse_scroll_callback(GLFWwindow* window, double x_offset, double y_offset); static void glfw_cursor_pos_callback(GLFWwindow* window, double x_pos, double y_pos); - private: GLFWwindow* m_window; EventHandler m_event_handler; @@ -48,5 +55,7 @@ namespace Donut unsigned int m_width; unsigned int m_height; bool m_is_closed; + bool m_cursor_locked = false; + bool m_cursor_visible = true; }; } -- cgit v1.3