diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/application.cpp | 8 | ||||
| -rw-r--r-- | src/core/application.h | 1 | ||||
| -rw-r--r-- | src/core/theme_manager.cpp | 291 | ||||
| -rw-r--r-- | src/core/theme_manager.h | 27 | ||||
| -rw-r--r-- | src/core/window.cpp | 95 | ||||
| -rw-r--r-- | src/core/window.h | 1 | ||||
| -rw-r--r-- | src/main.cpp | 2 | ||||
| -rw-r--r-- | src/states/config_state.cpp | 229 | ||||
| -rw-r--r-- | src/states/config_state.h | 25 | ||||
| -rw-r--r-- | src/states/simulation_state.cpp | 62 |
10 files changed, 618 insertions, 123 deletions
diff --git a/src/core/application.cpp b/src/core/application.cpp index 0698ce3..30194de 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -7,6 +7,7 @@ #include <GLFW/glfw3.h> + namespace Donut { Application* Application::s_instance = nullptr; @@ -133,7 +134,14 @@ namespace Donut m_state_manager->render(); m_window->begin_im_gui_frame(); + setup_docking_layout(); m_state_manager->on_im_ui_render(); m_window->end_im_gui_frame(); } + + void Application::setup_docking_layout() + { + ImGuiViewport* viewport = ImGui::GetMainViewport(); + ImGui::DockSpaceOverViewport(0, viewport, ImGuiDockNodeFlags_PassthruCentralNode); + } }; diff --git a/src/core/application.h b/src/core/application.h index d0abac3..521b15b 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -27,6 +27,7 @@ namespace Donut void on_update(); void on_render(); void on_event(Event& event); + void setup_docking_layout(); private: Scope<StateManager> m_state_manager; Scope<Window> m_window; diff --git a/src/core/theme_manager.cpp b/src/core/theme_manager.cpp new file mode 100644 index 0000000..db48e12 --- /dev/null +++ b/src/core/theme_manager.cpp @@ -0,0 +1,291 @@ +#include "theme_manager.h" + +namespace Donut +{ + Theme ThemeManager::s_current_theme = Theme::Dark; + + void ThemeManager::set_theme(Theme theme) + { + s_current_theme = theme; + + switch (theme) + { + case Theme::Dark: + apply_dark_theme(); + break; + case Theme::Light: + apply_light_theme(); + break; + case Theme::Blue: + apply_blue_theme(); + break; + } + } + + void ThemeManager::apply_dark_theme() + { + ImGuiStyle& style = ImGui::GetStyle(); + ImVec4* colors = style.Colors; + + colors[ImGuiCol_Text] = ImVec4(0.95f, 0.95f, 0.95f, 1.00f); + colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); + colors[ImGuiCol_WindowBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.95f); + colors[ImGuiCol_ChildBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.95f); + colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.95f); + colors[ImGuiCol_Border] = ImVec4(0.25f, 0.25f, 0.25f, 0.54f); + colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); + colors[ImGuiCol_FrameBg] = ImVec4(0.12f, 0.12f, 0.12f, 0.95f); + colors[ImGuiCol_FrameBgHovered] = ImVec4(0.18f, 0.18f, 0.18f, 0.95f); + colors[ImGuiCol_FrameBgActive] = ImVec4(0.22f, 0.22f, 0.22f, 0.95f); + colors[ImGuiCol_TitleBg] = ImVec4(0.08f, 0.08f, 0.08f, 1.00f); + colors[ImGuiCol_TitleBgActive] = ImVec4(0.08f, 0.08f, 0.08f, 1.00f); + colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f); + colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f); + colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f); + colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f); + colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f); + colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f); + colors[ImGuiCol_CheckMark] = ImVec4(0.60f, 0.60f, 0.60f, 0.95f); + colors[ImGuiCol_SliderGrab] = ImVec4(0.60f, 0.60f, 0.60f, 0.95f); + colors[ImGuiCol_SliderGrabActive] = ImVec4(0.70f, 0.70f, 0.70f, 0.95f); + colors[ImGuiCol_Button] = ImVec4(0.15f, 0.15f, 0.15f, 0.95f); + colors[ImGuiCol_ButtonHovered] = ImVec4(0.20f, 0.20f, 0.20f, 0.95f); + colors[ImGuiCol_ButtonActive] = ImVec4(0.25f, 0.25f, 0.25f, 0.95f); + colors[ImGuiCol_Header] = ImVec4(0.15f, 0.15f, 0.15f, 0.95f); + colors[ImGuiCol_HeaderHovered] = ImVec4(0.20f, 0.20f, 0.20f, 0.95f); + colors[ImGuiCol_HeaderActive] = ImVec4(0.25f, 0.25f, 0.25f, 0.95f); + colors[ImGuiCol_Separator] = ImVec4(0.43f, 0.43f, 0.43f, 0.50f); + colors[ImGuiCol_SeparatorHovered] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); + colors[ImGuiCol_SeparatorActive] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); + colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); + colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.29f, 0.30f, 0.31f, 0.67f); + colors[ImGuiCol_ResizeGripActive] = ImVec4(0.60f, 0.60f, 0.60f, 0.95f); + colors[ImGuiCol_Tab] = ImVec4(0.08f, 0.08f, 0.08f, 0.83f); + colors[ImGuiCol_TabHovered] = ImVec4(0.15f, 0.15f, 0.15f, 0.83f); + colors[ImGuiCol_TabActive] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); + colors[ImGuiCol_TabUnfocused] = ImVec4(0.08f, 0.08f, 0.08f, 0.97f); + colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.13f, 0.13f, 0.13f, 1.00f); + colors[ImGuiCol_DockingPreview] = ImVec4(0.60f, 0.60f, 0.60f, 0.70f); + colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); + colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f); + colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f); + colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); + colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); + colors[ImGuiCol_TextSelectedBg] = ImVec4(0.60f, 0.60f, 0.60f, 0.35f); + colors[ImGuiCol_DragDropTarget] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); + colors[ImGuiCol_NavHighlight] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); + colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); + colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); + colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f); + + style.WindowPadding = ImVec2(8, 8); + style.FramePadding = ImVec2(5, 2); + style.CellPadding = ImVec2(6, 4); + style.ItemSpacing = ImVec2(6, 4); + style.ItemInnerSpacing = ImVec2(4, 4); + style.IndentSpacing = 21; + style.ScrollbarSize = 14; + style.GrabMinSize = 10; + + style.WindowBorderSize = 1; + style.ChildBorderSize = 1; + style.PopupBorderSize = 1; + style.FrameBorderSize = 0; + style.TabBorderSize = 0; + + style.WindowRounding = 8.0f; + style.ChildRounding = 6.0f; + style.FrameRounding = 4.0f; + style.PopupRounding = 4.0f; + style.ScrollbarRounding = 4.0f; + style.GrabRounding = 4.0f; + style.TabRounding = 4.0f; + + style.WindowTitleAlign = ImVec2(0.5f, 0.5f); + style.ButtonTextAlign = ImVec2(0.5f, 0.5f); + style.SelectableTextAlign = ImVec2(0.0f, 0.0f); + + style.DisplaySafeAreaPadding = ImVec2(3, 3); + + style.Alpha = 1.0f; + style.DisabledAlpha = 0.6f; + } + + void ThemeManager::apply_light_theme() + { + ImGuiStyle& style = ImGui::GetStyle(); + ImVec4* colors = style.Colors; + + colors[ImGuiCol_Text] = ImVec4(0.10f, 0.10f, 0.10f, 1.00f); + colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); + colors[ImGuiCol_WindowBg] = ImVec4(0.95f, 0.95f, 0.95f, 0.95f); + colors[ImGuiCol_ChildBg] = ImVec4(0.92f, 0.92f, 0.92f, 0.95f); + colors[ImGuiCol_PopupBg] = ImVec4(0.95f, 0.95f, 0.95f, 0.95f); + colors[ImGuiCol_Border] = ImVec4(0.70f, 0.70f, 0.70f, 0.54f); + colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); + colors[ImGuiCol_FrameBg] = ImVec4(0.85f, 0.85f, 0.85f, 0.95f); + colors[ImGuiCol_FrameBgHovered] = ImVec4(0.80f, 0.80f, 0.80f, 0.95f); + colors[ImGuiCol_FrameBgActive] = ImVec4(0.75f, 0.75f, 0.75f, 0.95f); + colors[ImGuiCol_TitleBg] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); + colors[ImGuiCol_TitleBgActive] = ImVec4(0.85f, 0.85f, 0.85f, 1.00f); + colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.95f, 0.95f, 0.95f, 0.51f); + colors[ImGuiCol_MenuBarBg] = ImVec4(0.88f, 0.88f, 0.88f, 1.00f); + colors[ImGuiCol_ScrollbarBg] = ImVec4(0.90f, 0.90f, 0.90f, 0.53f); + colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.70f, 0.70f, 0.70f, 1.00f); + colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); + colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); + colors[ImGuiCol_CheckMark] = ImVec4(0.20f, 0.60f, 0.90f, 0.95f); + colors[ImGuiCol_SliderGrab] = ImVec4(0.20f, 0.60f, 0.90f, 0.95f); + colors[ImGuiCol_SliderGrabActive] = ImVec4(0.15f, 0.50f, 0.80f, 0.95f); + colors[ImGuiCol_Button] = ImVec4(0.80f, 0.80f, 0.80f, 0.95f); + colors[ImGuiCol_ButtonHovered] = ImVec4(0.75f, 0.75f, 0.75f, 0.95f); + colors[ImGuiCol_ButtonActive] = ImVec4(0.70f, 0.70f, 0.70f, 0.95f); + colors[ImGuiCol_Header] = ImVec4(0.85f, 0.85f, 0.85f, 0.95f); + colors[ImGuiCol_HeaderHovered] = ImVec4(0.80f, 0.80f, 0.80f, 0.95f); + colors[ImGuiCol_HeaderActive] = ImVec4(0.75f, 0.75f, 0.75f, 0.95f); + colors[ImGuiCol_Separator] = ImVec4(0.70f, 0.70f, 0.70f, 0.50f); + colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f); + colors[ImGuiCol_SeparatorActive] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); + colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); + colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.60f, 0.60f, 0.60f, 0.67f); + colors[ImGuiCol_ResizeGripActive] = ImVec4(0.20f, 0.60f, 0.90f, 0.95f); + colors[ImGuiCol_Tab] = ImVec4(0.85f, 0.85f, 0.85f, 0.83f); + colors[ImGuiCol_TabHovered] = ImVec4(0.80f, 0.80f, 0.80f, 0.83f); + colors[ImGuiCol_TabActive] = ImVec4(0.75f, 0.75f, 0.75f, 1.00f); + colors[ImGuiCol_TabUnfocused] = ImVec4(0.90f, 0.90f, 0.90f, 0.97f); + colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.85f, 0.85f, 0.85f, 1.00f); + colors[ImGuiCol_DockingPreview] = ImVec4(0.20f, 0.60f, 0.90f, 0.70f); + colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); + colors[ImGuiCol_PlotLines] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f); + colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.30f, 0.20f, 1.00f); + colors[ImGuiCol_PlotHistogram] = ImVec4(0.70f, 0.50f, 0.00f, 1.00f); + colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.80f, 0.40f, 0.00f, 1.00f); + colors[ImGuiCol_TextSelectedBg] = ImVec4(0.20f, 0.60f, 0.90f, 0.35f); + colors[ImGuiCol_DragDropTarget] = ImVec4(0.10f, 0.50f, 0.80f, 1.00f); + colors[ImGuiCol_NavHighlight] = ImVec4(0.20f, 0.60f, 0.90f, 1.00f); + colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.10f, 0.10f, 0.10f, 0.70f); + colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.20f); + colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f); + + style.WindowPadding = ImVec2(8, 8); + style.FramePadding = ImVec2(5, 2); + style.CellPadding = ImVec2(6, 4); + style.ItemSpacing = ImVec2(6, 4); + style.ItemInnerSpacing = ImVec2(4, 4); + style.IndentSpacing = 21; + style.ScrollbarSize = 14; + style.GrabMinSize = 10; + + style.WindowBorderSize = 1; + style.ChildBorderSize = 1; + style.PopupBorderSize = 1; + style.FrameBorderSize = 0; + style.TabBorderSize = 0; + + style.WindowRounding = 8.0f; + style.ChildRounding = 6.0f; + style.FrameRounding = 4.0f; + style.PopupRounding = 4.0f; + style.ScrollbarRounding = 4.0f; + style.GrabRounding = 4.0f; + style.TabRounding = 4.0f; + + style.WindowTitleAlign = ImVec2(0.5f, 0.5f); + style.ButtonTextAlign = ImVec2(0.5f, 0.5f); + style.SelectableTextAlign = ImVec2(0.0f, 0.0f); + + style.DisplaySafeAreaPadding = ImVec2(3, 3); + + style.Alpha = 1.0f; + style.DisabledAlpha = 0.6f; + } + + void ThemeManager::apply_blue_theme() + { + ImGuiStyle& style = ImGui::GetStyle(); + ImVec4* colors = style.Colors; + + colors[ImGuiCol_Text] = ImVec4(0.95f, 0.95f, 0.95f, 1.00f); + colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); + colors[ImGuiCol_WindowBg] = ImVec4(0.05f, 0.10f, 0.20f, 0.95f); + colors[ImGuiCol_ChildBg] = ImVec4(0.03f, 0.08f, 0.18f, 0.95f); + colors[ImGuiCol_PopupBg] = ImVec4(0.05f, 0.10f, 0.20f, 0.95f); + colors[ImGuiCol_Border] = ImVec4(0.20f, 0.30f, 0.50f, 0.54f); + colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); + colors[ImGuiCol_FrameBg] = ImVec4(0.08f, 0.15f, 0.30f, 0.95f); + colors[ImGuiCol_FrameBgHovered] = ImVec4(0.12f, 0.20f, 0.40f, 0.95f); + colors[ImGuiCol_FrameBgActive] = ImVec4(0.15f, 0.25f, 0.45f, 0.95f); + colors[ImGuiCol_TitleBg] = ImVec4(0.05f, 0.10f, 0.20f, 1.00f); + colors[ImGuiCol_TitleBgActive] = ImVec4(0.05f, 0.10f, 0.20f, 1.00f); + colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f); + colors[ImGuiCol_MenuBarBg] = ImVec4(0.08f, 0.15f, 0.25f, 1.00f); + colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.05f, 0.10f, 0.53f); + colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.30f, 0.40f, 0.60f, 1.00f); + colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.50f, 0.70f, 1.00f); + colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.50f, 0.60f, 0.80f, 1.00f); + colors[ImGuiCol_CheckMark] = ImVec4(0.20f, 0.60f, 1.00f, 0.95f); + colors[ImGuiCol_SliderGrab] = ImVec4(0.20f, 0.60f, 1.00f, 0.95f); + colors[ImGuiCol_SliderGrabActive] = ImVec4(0.30f, 0.70f, 1.00f, 0.95f); + colors[ImGuiCol_Button] = ImVec4(0.10f, 0.20f, 0.40f, 0.95f); + colors[ImGuiCol_ButtonHovered] = ImVec4(0.15f, 0.25f, 0.45f, 0.95f); + colors[ImGuiCol_ButtonActive] = ImVec4(0.20f, 0.30f, 0.50f, 0.95f); + colors[ImGuiCol_Header] = ImVec4(0.10f, 0.20f, 0.40f, 0.95f); + colors[ImGuiCol_HeaderHovered] = ImVec4(0.15f, 0.25f, 0.45f, 0.95f); + colors[ImGuiCol_HeaderActive] = ImVec4(0.20f, 0.30f, 0.50f, 0.95f); + colors[ImGuiCol_Separator] = ImVec4(0.30f, 0.40f, 0.60f, 0.50f); + colors[ImGuiCol_SeparatorHovered] = ImVec4(0.40f, 0.50f, 0.70f, 1.00f); + colors[ImGuiCol_SeparatorActive] = ImVec4(0.50f, 0.60f, 0.80f, 1.00f); + colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); + colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.30f, 0.40f, 0.60f, 0.67f); + colors[ImGuiCol_ResizeGripActive] = ImVec4(0.20f, 0.60f, 1.00f, 0.95f); + colors[ImGuiCol_Tab] = ImVec4(0.08f, 0.15f, 0.25f, 0.83f); + colors[ImGuiCol_TabHovered] = ImVec4(0.12f, 0.20f, 0.35f, 0.83f); + colors[ImGuiCol_TabActive] = ImVec4(0.15f, 0.25f, 0.40f, 1.00f); + colors[ImGuiCol_TabUnfocused] = ImVec4(0.05f, 0.10f, 0.20f, 0.97f); + colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.08f, 0.15f, 0.25f, 1.00f); + colors[ImGuiCol_DockingPreview] = ImVec4(0.20f, 0.60f, 1.00f, 0.70f); + colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.05f, 0.10f, 0.20f, 1.00f); + colors[ImGuiCol_PlotLines] = ImVec4(0.60f, 0.70f, 0.90f, 1.00f); + colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.60f, 0.40f, 1.00f); + colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.30f, 1.00f); + colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.80f, 0.40f, 1.00f); + colors[ImGuiCol_TextSelectedBg] = ImVec4(0.20f, 0.60f, 1.00f, 0.35f); + colors[ImGuiCol_DragDropTarget] = ImVec4(0.10f, 0.50f, 0.90f, 1.00f); + colors[ImGuiCol_NavHighlight] = ImVec4(0.20f, 0.60f, 1.00f, 1.00f); + colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); + colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); + colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f); + + style.WindowPadding = ImVec2(8, 8); + style.FramePadding = ImVec2(5, 2); + style.CellPadding = ImVec2(6, 4); + style.ItemSpacing = ImVec2(6, 4); + style.ItemInnerSpacing = ImVec2(4, 4); + style.IndentSpacing = 21; + style.ScrollbarSize = 14; + style.GrabMinSize = 10; + + style.WindowBorderSize = 1; + style.ChildBorderSize = 1; + style.PopupBorderSize = 1; + style.FrameBorderSize = 0; + style.TabBorderSize = 0; + + style.WindowRounding = 8.0f; + style.ChildRounding = 6.0f; + style.FrameRounding = 4.0f; + style.PopupRounding = 4.0f; + style.ScrollbarRounding = 4.0f; + style.GrabRounding = 4.0f; + style.TabRounding = 4.0f; + + style.WindowTitleAlign = ImVec2(0.5f, 0.5f); + style.ButtonTextAlign = ImVec2(0.5f, 0.5f); + style.SelectableTextAlign = ImVec2(0.0f, 0.0f); + + style.DisplaySafeAreaPadding = ImVec2(3, 3); + + style.Alpha = 1.0f; + style.DisabledAlpha = 0.6f; + } +} diff --git a/src/core/theme_manager.h b/src/core/theme_manager.h new file mode 100644 index 0000000..7c1a295 --- /dev/null +++ b/src/core/theme_manager.h @@ -0,0 +1,27 @@ +#pragma once + +#include <imgui.h> + +namespace Donut +{ + enum class Theme + { + Dark = 0, + Light = 1, + Blue = 2 + }; + + class ThemeManager + { + public: + static void set_theme(Theme theme); + static Theme get_current_theme() { return s_current_theme; } + + static void apply_dark_theme(); + static void apply_light_theme(); + static void apply_blue_theme(); + + private: + static Theme s_current_theme; + }; +} diff --git a/src/core/window.cpp b/src/core/window.cpp index 8441b85..c1d714a 100644 --- a/src/core/window.cpp +++ b/src/core/window.cpp @@ -1,5 +1,6 @@ #include <glad/glad.h> #include "window.h" +#include "theme_manager.h" #include <cstdint> @@ -120,7 +121,7 @@ namespace Donut io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; setup_im_gui_fonts(); - apply_im_gui_theme(); + ThemeManager::set_theme(Theme::Dark); ImGuiStyle& style = ImGui::GetStyle(); if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) @@ -161,98 +162,6 @@ namespace Donut DONUT_INFO("ImGUI fonts loaded successfully"); } - void Window::apply_im_gui_theme() - { - ImGuiStyle& style = ImGui::GetStyle(); - ImVec4* colors = style.Colors; - - colors[ImGuiCol_Text] = ImVec4(0.95f, 0.95f, 0.95f, 1.00f); - colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f); - colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.14f, 0.15f, 1.00f); - colors[ImGuiCol_ChildBg] = ImVec4(0.13f, 0.14f, 0.15f, 1.00f); - colors[ImGuiCol_PopupBg] = ImVec4(0.13f, 0.14f, 0.15f, 1.00f); - colors[ImGuiCol_Border] = ImVec4(0.25f, 0.25f, 0.26f, 0.54f); - colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); - colors[ImGuiCol_FrameBg] = ImVec4(0.25f, 0.25f, 0.26f, 1.00f); - colors[ImGuiCol_FrameBgHovered] = ImVec4(0.38f, 0.38f, 0.39f, 1.00f); - colors[ImGuiCol_FrameBgActive] = ImVec4(0.67f, 0.67f, 0.67f, 0.39f); - colors[ImGuiCol_TitleBg] = ImVec4(0.08f, 0.08f, 0.09f, 1.00f); - colors[ImGuiCol_TitleBgActive] = ImVec4(0.08f, 0.08f, 0.09f, 1.00f); - colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f); - colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f); - colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f); - colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f); - colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f); - colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f); - colors[ImGuiCol_CheckMark] = ImVec4(0.11f, 0.64f, 0.92f, 1.00f); - colors[ImGuiCol_SliderGrab] = ImVec4(0.11f, 0.64f, 0.92f, 1.00f); - colors[ImGuiCol_SliderGrabActive] = ImVec4(0.08f, 0.50f, 0.72f, 1.00f); - colors[ImGuiCol_Button] = ImVec4(0.25f, 0.25f, 0.26f, 1.00f); - colors[ImGuiCol_ButtonHovered] = ImVec4(0.38f, 0.38f, 0.39f, 1.00f); - colors[ImGuiCol_ButtonActive] = ImVec4(0.67f, 0.67f, 0.67f, 0.39f); - colors[ImGuiCol_Header] = ImVec4(0.22f, 0.22f, 0.22f, 1.00f); - colors[ImGuiCol_HeaderHovered] = ImVec4(0.25f, 0.25f, 0.26f, 1.00f); - colors[ImGuiCol_HeaderActive] = ImVec4(0.67f, 0.67f, 0.67f, 0.39f); - colors[ImGuiCol_Separator] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f); - colors[ImGuiCol_SeparatorHovered] = ImVec4(0.41f, 0.42f, 0.44f, 1.00f); - colors[ImGuiCol_SeparatorActive] = ImVec4(0.42f, 0.42f, 0.44f, 1.00f); - colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); - colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.29f, 0.30f, 0.31f, 0.67f); - colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f); - colors[ImGuiCol_Tab] = ImVec4(0.08f, 0.08f, 0.09f, 0.83f); - colors[ImGuiCol_TabHovered] = ImVec4(0.33f, 0.34f, 0.36f, 0.83f); - colors[ImGuiCol_TabActive] = ImVec4(0.23f, 0.23f, 0.24f, 1.00f); - colors[ImGuiCol_TabUnfocused] = ImVec4(0.08f, 0.08f, 0.09f, 0.97f); - colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.13f, 0.14f, 0.15f, 1.00f); - colors[ImGuiCol_DockingPreview] = ImVec4(0.26f, 0.59f, 0.98f, 0.70f); - colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); - colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f); - colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f); - colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); - colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); - colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); - colors[ImGuiCol_DragDropTarget] = ImVec4(0.11f, 0.64f, 0.92f, 1.00f); - colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); - colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f); - colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f); - colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f); - - style.WindowPadding = ImVec2(8, 8); - style.FramePadding = ImVec2(5, 2); - style.CellPadding = ImVec2(6, 4); - style.ItemSpacing = ImVec2(6, 4); - style.ItemInnerSpacing = ImVec2(4, 4); - style.IndentSpacing = 21; - style.ScrollbarSize = 14; - style.GrabMinSize = 10; - - style.WindowBorderSize = 1; - style.ChildBorderSize = 1; - style.PopupBorderSize = 1; - style.FrameBorderSize = 0; - style.TabBorderSize = 0; - - style.WindowRounding = 7; - style.ChildRounding = 4; - style.FrameRounding = 3; - style.PopupRounding = 4; - style.ScrollbarRounding = 9; - style.GrabRounding = 3; - style.TabRounding = 4; - - style.WindowTitleAlign = ImVec2(0.5f, 0.5f); - style.ButtonTextAlign = ImVec2(0.5f, 0.5f); - style.SelectableTextAlign = ImVec2(0.0f, 0.0f); - - style.DisplaySafeAreaPadding = ImVec2(3, 3); - - style.Alpha = 1.0f; - style.DisabledAlpha = 0.6f; - - ImGuiIO& io = ImGui::GetIO(); - io.FontGlobalScale = 1.0f; - } - void Window::shutdown_im_gui() { ImGui_ImplOpenGL3_Shutdown(); diff --git a/src/core/window.h b/src/core/window.h index 8b0945f..92842ba 100644 --- a/src/core/window.h +++ b/src/core/window.h @@ -46,7 +46,6 @@ namespace Donut void shutdown(); void setup_im_gui_fonts(); - void apply_im_gui_theme(); void shutdown_im_gui(); static void glfw_error_callback(int error, const char* description); diff --git a/src/main.cpp b/src/main.cpp index 8138e0e..323d141 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,7 +2,7 @@ int main() { - Donut::Application* app = new Donut::Application(); + Donut::Application* app = new Donut::Application("Donut Engine - Black Hole Simulation", 1280, 720); app->run(); delete app; } diff --git a/src/states/config_state.cpp b/src/states/config_state.cpp index d29408b..8cf24ef 100644 --- a/src/states/config_state.cpp +++ b/src/states/config_state.cpp @@ -1,14 +1,20 @@ #include "config_state.h" #include "rendering/renderer.h" #include "core/application.h" +#include "core/theme_manager.h" #include <imgui.h> +#include <imgui_internal.h> +#include <glad/glad.h> namespace Donut { void ConfigState::on_enter() { DONUT_INFO("Entering Config State"); + + m_selected_api = Renderer::get_api(); + m_selected_theme = static_cast<int>(ThemeManager::get_current_theme()); } void ConfigState::on_exit() @@ -18,11 +24,20 @@ namespace Donut void ConfigState::on_update(float delta_time) { + if (m_show_restart_message) + { + m_restart_message_timer += delta_time; + if (m_restart_message_timer > 3.0f) + { + m_show_restart_message = false; + m_restart_message_timer = 0.0f; + } + } } void ConfigState::on_render() { - Renderer::set_clear_color({ 0.1f, 0.1f, 0.1f, 1.0f }); + Renderer::set_clear_color({ 0.05f, 0.05f, 0.1f, 1.0f }); Renderer::clear(); } @@ -32,10 +47,216 @@ namespace Donut void ConfigState::on_im_ui_render() { - ImGui::Begin("Configuration"); - ImGui::Text("Configuration State"); - if (ImGui::Button("Start Simulation")) + ImGui::SetNextWindowSize(ImVec2(900, 700), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x * 0.5f, ImGui::GetIO().DisplaySize.y * 0.5f), + ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f)); + + ImGui::Begin("Donut Configuration", nullptr, ImGuiWindowFlags_NoCollapse); + + ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[0]); + ImGui::TextColored(ImVec4(0.8f, 0.8f, 1.0f, 1.0f), "Donut Configuration"); + ImGui::PopFont(); + ImGui::Separator(); + + ImGui::Columns(2, "ConfigColumns", true); + + float available_height = ImGui::GetWindowHeight() - 140; + + ImGui::BeginChild("GraphicsSettings", ImVec2(0, available_height), true, ImGuiWindowFlags_AlwaysVerticalScrollbar); + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Graphics Settings"); + ImGui::Separator(); + + ImGui::Text("Render API:"); + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "(requires restart)"); + + const char* api_names[] = { "OpenGL", "Vulkan" }; + static int current_api = (int)m_selected_api - 1; + + if (ImGui::BeginCombo("##RenderAPI", api_names[current_api])) + { + for (int i = 0; i < IM_ARRAYSIZE(api_names); i++) + { + const bool is_selected = (current_api == i); + if (ImGui::Selectable(api_names[i], is_selected)) + { + current_api = i; + m_selected_api = (RendererAPI::API)(i + 1); + m_show_restart_message = true; + m_restart_message_timer = 0.0f; + } + + if (is_selected) + ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + } + + ImGui::Text("Current API: "); + ImGui::SameLine(); + const char* current_api_name = (Renderer::get_api() == RendererAPI::API::OpenGL) ? "OpenGL" : "Vulkan"; + ImGui::TextColored(ImVec4(0.3f, 0.8f, 0.3f, 1.0f), current_api_name); + + ImGui::Spacing(); + + ImGui::Checkbox("Enable VSync", &m_v_sync_enabled); + ImGui::SameLine(); + ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "(recommended)"); + + ImGui::Spacing(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Display"); + ImGui::Separator(); + + ImGui::Text("Window Size: 1280x720"); + ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "Fullscreen: Not implemented yet"); + + ImGui::Spacing(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "System Info"); + ImGui::Separator(); + + ImGui::Text("OpenGL Version: %s", glGetString(GL_VERSION)); + ImGui::Text("GPU: %s", glGetString(GL_RENDERER)); + ImGui::Text("Vendor: %s", glGetString(GL_VENDOR)); + + ImGui::Spacing(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Performance"); + ImGui::Separator(); + + ImGui::SliderInt("Target FPS", &m_target_fps, 30, 120, "%d FPS"); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Target frame rate for the simulation"); + + ImGui::Checkbox("Show FPS Counter", &m_show_fps); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Display current FPS in the simulation"); + + ImGui::Checkbox("Show Performance Metrics", &m_show_performance_metrics); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Show detailed performance information"); + + ImGui::Checkbox("Show Debug Info", &m_show_debug_info); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Display debug information and statistics"); + + ImGui::Checkbox("Enable Anti-Aliasing", &m_enable_anti_aliasing); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Enable anti-aliasing for smoother rendering"); + + ImGui::Spacing(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Theme"); + ImGui::Separator(); + + const char* theme_names[] = { "Dark", "Light", "Blue" }; + if (ImGui::Combo("UI Theme", &m_selected_theme, theme_names, IM_ARRAYSIZE(theme_names))) + ThemeManager::set_theme(static_cast<Theme>(m_selected_theme)); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Choose the application theme"); + + ImGui::EndChild(); + + ImGui::NextColumn(); + + ImGui::BeginChild("SimulationSettings", ImVec2(0, available_height), true, ImGuiWindowFlags_AlwaysVerticalScrollbar); + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Simulation Settings"); + ImGui::Separator(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Quality"); + ImGui::Separator(); + + ImGui::SliderInt("Compute Height", &m_compute_height, 64, 2048, "%d px"); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Resolution of the compute shader. Higher values give better quality but lower performance."); + ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "Higher = better quality, lower performance"); + + ImGui::SliderInt("Max Steps (Moving)", &m_max_steps_moving, 1000, 60000, "%d"); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Maximum ray marching steps when camera is moving"); + + ImGui::SliderInt("Max Steps (Static)", &m_max_steps_static, 1000, 30000, "%d"); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Maximum ray marching steps when camera is stationary"); + + ImGui::SliderFloat("Early Exit Distance", &m_early_exit_distance, 1e11f, 1e13f, "%.2e"); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Distance at which ray marching stops to improve performance"); + ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "Distance at which ray marching stops"); + + ImGui::Spacing(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Physics"); + ImGui::Separator(); + + ImGui::Checkbox("Enable Gravity", &m_gravity_enabled); + + ImGui::EndChild(); + + ImGui::Columns(1); + + ImGui::Spacing(); + ImGui::Separator(); + ImGui::Spacing(); + + float button_width = (ImGui::GetWindowWidth() - 80) / 4.0f; + + if (ImGui::Button("Start Simulation", ImVec2(button_width, 35))) + { + apply_settings(); Application::get().get_state_manager().switch_to_state("Simulation"); + } + + ImGui::SameLine(); + if (ImGui::Button("Reset to Defaults", ImVec2(button_width, 35))) + reset_to_defaults(); + + ImGui::SameLine(); + if (ImGui::Button("Apply Settings", ImVec2(button_width, 35))) + apply_settings(); + + ImGui::SameLine(); + if (ImGui::Button("Exit", ImVec2(button_width, 35))) + Application::get().close(); + + if (m_show_restart_message) + { + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.8f, 0.2f, 1.0f)); + ImGui::TextWrapped("Warning: Render API changed! Please restart the application for changes to take effect."); + ImGui::PopStyleColor(); + } + + ImGui::Spacing(); + ImGui::Separator(); + ImGui::TextColored(ImVec4(0.5f, 0.5f, 0.5f, 1.0f), "Donut Engine v1.0.0 | Black Hole Simulation"); + ImGui::End(); } + + void ConfigState::apply_settings() + { + RendererAPI::set_api(m_selected_api); + DONUT_INFO("Settings applied"); + } + + void ConfigState::reset_to_defaults() + { + m_selected_api = RendererAPI::API::OpenGL; + m_target_fps = 60; + m_compute_height = 512; + m_max_steps_moving = 30000; + m_max_steps_static = 15000; + m_early_exit_distance = 5e12f; + m_gravity_enabled = true; + m_v_sync_enabled = true; + m_show_fps = true; + m_show_performance_metrics = true; + m_show_debug_info = false; + m_enable_anti_aliasing = true; + m_selected_theme = 0; + + DONUT_INFO("Settings reset to defaults"); + } }; diff --git a/src/states/config_state.h b/src/states/config_state.h index 15aff5c..7a31f8c 100644 --- a/src/states/config_state.h +++ b/src/states/config_state.h @@ -3,6 +3,7 @@ #include "core/state.h" #include "core/event.h" #include "core/log.h" +#include "rendering/renderer.h" namespace Donut { @@ -18,5 +19,29 @@ namespace Donut void on_render() override; void on_im_ui_render() override; void on_event(Event& event) override; + + private: + void apply_settings(); + void reset_to_defaults(); + + private: + RendererAPI::API m_selected_api = RendererAPI::API::OpenGL; + bool m_show_restart_message = false; + float m_restart_message_timer = 0.0f; + + int m_target_fps = 60; + int m_compute_height = 512; + int m_max_steps_moving = 30000; + int m_max_steps_static = 15000; + float m_early_exit_distance = 5e12f; + bool m_gravity_enabled = true; + + bool m_v_sync_enabled = true; + bool m_show_fps = true; + bool m_show_performance_metrics = true; + bool m_show_debug_info = false; + bool m_enable_anti_aliasing = true; + + int m_selected_theme = 0; }; }; diff --git a/src/states/simulation_state.cpp b/src/states/simulation_state.cpp index ecb2898..ff7f658 100644 --- a/src/states/simulation_state.cpp +++ b/src/states/simulation_state.cpp @@ -86,32 +86,36 @@ namespace Donut void SimulationState::on_im_ui_render() { - ImGui::Begin("Simulation Controls"); + ImGui::SetNextWindowSize(ImVec2(400, 600), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowPos(ImVec2(ImGui::GetIO().DisplaySize.x - 420, 20), ImGuiCond_FirstUseEver); - ImGui::Text("Black Hole Simulation"); + ImGui::Begin("Simulation Controls", nullptr, ImGuiWindowFlags_NoCollapse); + + ImGui::TextColored(ImVec4(0.8f, 0.8f, 1.0f, 1.0f), "Black Hole Simulation"); if (ImGui::Button("Back to Config")) Application::get().get_state_manager().switch_to_state("Config"); ImGui::Separator(); - ImGui::Text("Simulation Info:"); - ImGui::Text("FPS: %.1f", ImGui::GetIO().Framerate); - ImGui::Text("Frame Time: %.3f ms", 1000.0f / ImGui::GetIO().Framerate); - ImGui::Text("Resolution: %dx%d", m_engine.get_width(), m_engine.get_height()); - ImGui::Text("Compute Resolution: %dx%d", m_engine.get_compute_width(), m_engine.get_compute_height()); - ImGui::Text("Objects: %zu", m_engine.get_objects().size()); - + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Performance"); ImGui::Separator(); - ImGui::Text("Performance:"); + ImGui::Text("FPS: %.1f", ImGui::GetIO().Framerate); + ImGui::Text("Frame Time: %.3f ms", 1000.0f / ImGui::GetIO().Framerate); ImGui::Text("Engine FPS: %.1f", m_engine.get_current_fps()); - ImGui::Text("Target FPS: %d", m_engine.get_target_fps()); int target_fps = m_engine.get_target_fps(); if (ImGui::SliderInt("Target FPS", &target_fps, 30, 120)) - { m_engine.set_target_fps(target_fps); - } + + ImGui::Spacing(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Simulation Info"); + ImGui::Separator(); + + ImGui::Text("Resolution: %dx%d", m_engine.get_width(), m_engine.get_height()); + ImGui::Text("Compute Resolution: %dx%d", m_engine.get_compute_width(), m_engine.get_compute_height()); + ImGui::Text("Objects: %zu", m_engine.get_objects().size()); int compute_height = m_engine.get_compute_height(); if (ImGui::SliderInt("Compute Height", &compute_height, 64, 2048)) @@ -120,11 +124,13 @@ namespace Donut m_engine.update_compute_dimensions(); } - ImGui::Text("Compute Width: %d (auto-calculated)", m_engine.get_compute_width()); + ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "Compute Width: %d (auto-calculated)", m_engine.get_compute_width()); + ImGui::Spacing(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Quality Settings"); ImGui::Separator(); - ImGui::Text("Simulation Quality:"); int max_steps_moving = m_engine.get_max_steps_moving(); if (ImGui::SliderInt("Max Steps (Moving)", &max_steps_moving, 1000, 60000)) m_engine.set_max_steps_moving(max_steps_moving); @@ -135,21 +141,19 @@ namespace Donut if (ImGui::SliderFloat("Early Exit Distance", &early_exit_distance, 1e11f, 1e13f, "%.2e")) m_engine.set_early_exit_distance(early_exit_distance); - ImGui::Separator(); - - ImGui::Text("Controls:"); - ImGui::Text("Left Mouse: Orbit camera"); - ImGui::Text("Scroll: Zoom in/out"); - ImGui::Text("G: Toggle gravity"); - ImGui::Text("Right Mouse: Enable gravity (hold)"); + ImGui::Spacing(); + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Physics"); ImGui::Separator(); - ImGui::Text("Physics:"); bool& gravity = m_engine.get_gravity(); ImGui::Checkbox("Gravity Enabled", &gravity); - ImGui::Text("Camera:"); + ImGui::Spacing(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Camera"); + ImGui::Separator(); + ImGui::Text("Position: (%.2e, %.2e, %.2e)", m_engine.get_camera().get_orbital_position().x, m_engine.get_camera().get_orbital_position().y, @@ -158,6 +162,16 @@ namespace Donut ImGui::Text("Azimuth: %.2f", m_engine.get_camera().get_azimuth()); ImGui::Text("Elevation: %.2f", m_engine.get_camera().get_elevation()); + ImGui::Spacing(); + + ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Controls"); + ImGui::Separator(); + + ImGui::Text("Left Mouse: Orbit camera"); + ImGui::Text("Scroll: Zoom in/out"); + ImGui::Text("G: Toggle gravity"); + ImGui::Text("Right Mouse: Enable gravity (hold)"); + ImGui::End(); } }; |
