diff options
| author | hachem <im@hachem.wtf> | 2026-08-20 02:27:02 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-20 02:40:07 +0200 |
| commit | 5b361d81dbd2af0d0e99b9eb1adebea76ff05db0 (patch) | |
| tree | 34db1df17e8c7248aeeb92156d635d31c2484e3f /src/Core/Window.h | |
| parent | e3abaaf59777258ba06705135a0cafcb5918ad12 (diff) | |
[chore]: MASSIVE refactor + more vulkan bs
Diffstat (limited to 'src/Core/Window.h')
| -rw-r--r-- | src/Core/Window.h | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/src/Core/Window.h b/src/Core/Window.h index f450bad..9b7d7b9 100644 --- a/src/Core/Window.h +++ b/src/Core/Window.h @@ -1,7 +1,7 @@ #pragma once -#include "Event.h" -#include "Log.h" +#include "event.h" +#include "log.h" #include <GLFW/glfw3.h> #include <imgui.h> @@ -18,59 +18,61 @@ namespace Donut Window(const std::string& title, int width, int height); ~Window(); - bool ShouldClose() const; - void OnUpdate() const; + auto should_close() const -> bool; + auto on_update() const -> void; - void SetEventCallback(const EventCallbackFn& callback) + auto set_event_callback(const EventCallbackFn& callback) -> void { - m_EventHandler.SetEventCallback(callback); + m_event_handler.set_event_callback(callback); } - EventHandler& GetEventHandler() { return m_EventHandler; } + auto get_event_handler() -> EventHandler& { return m_event_handler; } - unsigned int GetWidth() const { return m_Width; } - unsigned int GetHeight() const { return m_Height; } + auto get_width() const -> unsigned int { return m_width; } + auto get_height() const -> unsigned int { return m_height; } - void* GetNativeWindow() 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 SetCursorLocked(bool locked); - void SetCursorVisible(bool visible); - bool IsCursorLocked() const { return m_CursorLocked; } - bool IsCursorVisible() const { return m_CursorVisible; } - - void InitImGui(); - void BeginImGuiFrame(); - void EndImGuiFrame(); 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 SetupImGuiFonts(); - void ShutdownImGui(); - - static void GLFWErrorCallback(int error, const char* description); - static void GLFWWindowCloseCallback(GLFWwindow* window); - static void GLFWWindowSizeCallback(GLFWwindow* window, int width, int height); - static void GLFWWindowFocusCallback(GLFWwindow* window, int focused); - static void GLFWWindowPosCallback(GLFWwindow* window, int xpos, int ypos); - static void GLFWKeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); - static void GLFWCharCallback(GLFWwindow* window, unsigned int keycode); - static void GLFWMouseButtonCallback(GLFWwindow* window, int button, int action, int mods); - static void GLFWMouseScrollCallback(GLFWwindow* window, double xOffset, double yOffset); - static void GLFWCursorPosCallback(GLFWwindow* window, double xPos, double yPos); private: - GLFWwindow* m_Window; - EventHandler m_EventHandler; + GLFWwindow* m_window; + EventHandler m_event_handler; + + std::string m_title; + unsigned int m_width; + unsigned int m_height; + bool m_is_closed; + bool m_cursor_locked = false; + bool m_cursor_visible = true; - std::string m_Title; - unsigned int m_Width; - unsigned int m_Height; - bool m_IsClosed; - bool m_CursorLocked = false; - bool m_CursorVisible = true; - - ImFont* m_MainFont = nullptr; - ImFont* m_SmallFont = nullptr; - ImFont* m_LargeFont = nullptr; + ImFont* m_main_font = nullptr; + ImFont* m_small_font = nullptr; + ImFont* m_large_font = nullptr; }; -}
\ No newline at end of file +} |
