hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/core/window.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-20 01:57:44 +0200
committerhachem <im@hachem.wtf>2026-08-20 02:10:49 +0200
commit7d39ee93a6d354e727c7534a18663f1d00d46b0f (patch)
treea188023b61d14dcb859e08e6f8f8dd30df11780f /src/core/window.h
parentdce67620b95a9555c7db950196b22f1bb88a307b (diff)
refactor: trailing return types in core
Diffstat (limited to 'src/core/window.h')
-rw-r--r--src/core/window.h64
1 files changed, 33 insertions, 31 deletions
diff --git a/src/core/window.h b/src/core/window.h
index 92842ba..9b7d7b9 100644
--- a/src/core/window.h
+++ b/src/core/window.h
@@ -18,46 +18,48 @@ namespace Donut
Window(const std::string& title, int width, int height);
~Window();
- bool should_close() const;
- void on_update() const;
+ auto should_close() const -> bool;
+ auto on_update() const -> void;
- void set_event_callback(const EventCallbackFn& callback)
+ auto set_event_callback(const EventCallbackFn& callback) -> void
{
m_event_handler.set_event_callback(callback);
}
- EventHandler& get_event_handler() { return m_event_handler; }
+ auto get_event_handler() -> EventHandler& { return m_event_handler; }
- unsigned int get_width() const { return m_width; }
- unsigned int get_height() const { return m_height; }
+ auto get_width() const -> unsigned int { return m_width; }
+ auto get_height() const -> unsigned int { return m_height; }
- void* get_native_window() const { return m_window; }
+ auto get_native_window() const -> void* { return m_window; }
+
+ auto set_cursor_locked(bool locked) -> void;
+ auto set_cursor_visible(bool visible) -> void;
+ auto is_cursor_locked() const -> bool { return m_cursor_locked; }
+ auto is_cursor_visible() const -> bool { return m_cursor_visible; }
+
+ auto init_im_gui() -> void;
+ auto begin_im_gui_frame() -> void;
+ auto end_im_gui_frame() -> void;
- 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; }
-
- void init_im_gui();
- void begin_im_gui_frame();
- void end_im_gui_frame();
private:
- void init();
- void shutdown();
+ auto init() -> void;
+ auto shutdown() -> void;
+
+ auto setup_im_gui_fonts() -> void;
+ auto shutdown_im_gui() -> void;
+
+ static auto glfw_error_callback(int error, const char* description) -> void;
+ static auto glfw_window_close_callback(GLFWwindow* window) -> void;
+ static auto glfw_window_size_callback(GLFWwindow* window, int width, int height) -> void;
+ static auto glfw_window_focus_callback(GLFWwindow* window, int focused) -> void;
+ static auto glfw_window_pos_callback(GLFWwindow* window, int xpos, int ypos) -> void;
+ static auto glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) -> void;
+ static auto glfw_char_callback(GLFWwindow* window, unsigned int keycode) -> void;
+ static auto glfw_mouse_button_callback(GLFWwindow* window, int button, int action, int mods) -> void;
+ static auto glfw_mouse_scroll_callback(GLFWwindow* window, double x_offset, double y_offset) -> void;
+ static auto glfw_cursor_pos_callback(GLFWwindow* window, double x_pos, double y_pos) -> void;
- void setup_im_gui_fonts();
- void shutdown_im_gui();
-
- static void glfw_error_callback(int error, const char* description);
- static void glfw_window_close_callback(GLFWwindow* window);
- static void glfw_window_size_callback(GLFWwindow* window, int width, int height);
- static void glfw_window_focus_callback(GLFWwindow* window, int focused);
- static void glfw_window_pos_callback(GLFWwindow* window, int xpos, int ypos);
- static void glfw_key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
- static void glfw_char_callback(GLFWwindow* window, unsigned int keycode);
- 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;
@@ -68,7 +70,7 @@ namespace Donut
bool m_is_closed;
bool m_cursor_locked = false;
bool m_cursor_visible = true;
-
+
ImFont* m_main_font = nullptr;
ImFont* m_small_font = nullptr;
ImFont* m_large_font = nullptr;