aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Core/Application.cpp8
-rw-r--r--src/Core/Application.h1
-rw-r--r--src/Core/ThemeManager.cpp291
-rw-r--r--src/Core/ThemeManager.h27
-rw-r--r--src/Core/Window.cpp95
-rw-r--r--src/Core/Window.h1
-rw-r--r--src/States/ConfigState.cpp229
-rw-r--r--src/States/ConfigState.h26
-rw-r--r--src/States/SimulationState.cpp62
-rw-r--r--src/main.cpp2
10 files changed, 619 insertions, 123 deletions
diff --git a/src/Core/Application.cpp b/src/Core/Application.cpp
index 9aac646..302132a 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_StateManager->Render();
m_Window->BeginImGuiFrame();
+ SetupDockingLayout();
m_StateManager->OnImUIRender();
m_Window->EndImGuiFrame();
}
+
+ void Application::SetupDockingLayout()
+ {
+ ImGuiViewport* viewport = ImGui::GetMainViewport();
+ ImGui::DockSpaceOverViewport(0, viewport, ImGuiDockNodeFlags_PassthruCentralNode);
+ }
};
diff --git a/src/Core/Application.h b/src/Core/Application.h
index 39d28bb..c882bf6 100644
--- a/src/Core/Application.h
+++ b/src/Core/Application.h
@@ -27,6 +27,7 @@ namespace Donut
void OnUpdate();
void OnRender();
void OnEvent(Event& event);
+ void SetupDockingLayout();
private:
Scope<StateManager> m_StateManager;
Scope<Window> m_Window;
diff --git a/src/Core/ThemeManager.cpp b/src/Core/ThemeManager.cpp
new file mode 100644
index 0000000..e7e2f9e
--- /dev/null
+++ b/src/Core/ThemeManager.cpp
@@ -0,0 +1,291 @@
+#include "ThemeManager.h"
+
+namespace Donut
+{
+ Theme ThemeManager::s_CurrentTheme = Theme::Dark;
+
+ void ThemeManager::SetTheme(Theme theme)
+ {
+ s_CurrentTheme = theme;
+
+ switch (theme)
+ {
+ case Theme::Dark:
+ ApplyDarkTheme();
+ break;
+ case Theme::Light:
+ ApplyLightTheme();
+ break;
+ case Theme::Blue:
+ ApplyBlueTheme();
+ break;
+ }
+ }
+
+ void ThemeManager::ApplyDarkTheme()
+ {
+ 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::ApplyLightTheme()
+ {
+ 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::ApplyBlueTheme()
+ {
+ 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/ThemeManager.h b/src/Core/ThemeManager.h
new file mode 100644
index 0000000..7ff08ea
--- /dev/null
+++ b/src/Core/ThemeManager.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 SetTheme(Theme theme);
+ static Theme GetCurrentTheme() { return s_CurrentTheme; }
+
+ static void ApplyDarkTheme();
+ static void ApplyLightTheme();
+ static void ApplyBlueTheme();
+
+ private:
+ static Theme s_CurrentTheme;
+ };
+}
diff --git a/src/Core/Window.cpp b/src/Core/Window.cpp
index f6f1d4e..d0ca6d8 100644
--- a/src/Core/Window.cpp
+++ b/src/Core/Window.cpp
@@ -1,5 +1,6 @@
#include <glad/glad.h>
#include "Window.h"
+#include "ThemeManager.h"
#include <cstdint>
@@ -120,7 +121,7 @@ namespace Donut
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
SetupImGuiFonts();
- ApplyImGuiTheme();
+ ThemeManager::SetTheme(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::ApplyImGuiTheme()
- {
- 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::ShutdownImGui()
{
ImGui_ImplOpenGL3_Shutdown();
diff --git a/src/Core/Window.h b/src/Core/Window.h
index 3afd52f..f450bad 100644
--- a/src/Core/Window.h
+++ b/src/Core/Window.h
@@ -46,7 +46,6 @@ namespace Donut
void Shutdown();
void SetupImGuiFonts();
- void ApplyImGuiTheme();
void ShutdownImGui();
static void GLFWErrorCallback(int error, const char* description);
diff --git a/src/States/ConfigState.cpp b/src/States/ConfigState.cpp
index 8fd59db..688c48a 100644
--- a/src/States/ConfigState.cpp
+++ b/src/States/ConfigState.cpp
@@ -1,14 +1,20 @@
#include "ConfigState.h"
#include "Rendering/Renderer.h"
#include "Core/Application.h"
+#include "Core/ThemeManager.h"
#include <imgui.h>
+#include <imgui_internal.h>
+#include <glad/glad.h>
namespace Donut
{
void ConfigState::OnEnter()
{
DONUT_INFO("Entering Config State");
+
+ m_SelectedAPI = Renderer::GetAPI();
+ m_SelectedTheme = static_cast<int>(ThemeManager::GetCurrentTheme());
}
void ConfigState::OnExit()
@@ -18,11 +24,20 @@ namespace Donut
void ConfigState::OnUpdate(float deltaTime)
{
+ if (m_ShowRestartMessage)
+ {
+ m_RestartMessageTimer += deltaTime;
+ if (m_RestartMessageTimer > 3.0f)
+ {
+ m_ShowRestartMessage = false;
+ m_RestartMessageTimer = 0.0f;
+ }
+ }
}
void ConfigState::OnRender()
{
- Renderer::SetClearColor({ 0.1f, 0.1f, 0.1f, 1.0f });
+ Renderer::SetClearColor({ 0.05f, 0.05f, 0.1f, 1.0f });
Renderer::Clear();
}
@@ -32,10 +47,216 @@ namespace Donut
void ConfigState::OnImUIRender()
{
- 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 availableHeight = ImGui::GetWindowHeight() - 140; // Reserve space for header, separator, buttons, and footer
+
+ ImGui::BeginChild("GraphicsSettings", ImVec2(0, availableHeight), 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* apiNames[] = { "OpenGL", "Vulkan" };
+ static int currentAPI = (int)m_SelectedAPI - 1;
+
+ if (ImGui::BeginCombo("##RenderAPI", apiNames[currentAPI]))
+ {
+ for (int i = 0; i < IM_ARRAYSIZE(apiNames); i++)
+ {
+ const bool isSelected = (currentAPI == i);
+ if (ImGui::Selectable(apiNames[i], isSelected))
+ {
+ currentAPI = i;
+ m_SelectedAPI = (RendererAPI::API)(i + 1);
+ m_ShowRestartMessage = true;
+ m_RestartMessageTimer = 0.0f;
+ }
+
+ if (isSelected)
+ ImGui::SetItemDefaultFocus();
+ }
+ ImGui::EndCombo();
+ }
+
+ ImGui::Text("Current API: ");
+ ImGui::SameLine();
+ const char* currentAPIName = (Renderer::GetAPI() == RendererAPI::API::OpenGL) ? "OpenGL" : "Vulkan";
+ ImGui::TextColored(ImVec4(0.3f, 0.8f, 0.3f, 1.0f), currentAPIName);
+
+ ImGui::Spacing();
+
+ ImGui::Checkbox("Enable VSync", &m_VSyncEnabled);
+ 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_TargetFPS, 30, 120, "%d FPS");
+ if (ImGui::IsItemHovered())
+ ImGui::SetTooltip("Target frame rate for the simulation");
+
+ ImGui::Checkbox("Show FPS Counter", &m_ShowFPS);
+ if (ImGui::IsItemHovered())
+ ImGui::SetTooltip("Display current FPS in the simulation");
+
+ ImGui::Checkbox("Show Performance Metrics", &m_ShowPerformanceMetrics);
+ if (ImGui::IsItemHovered())
+ ImGui::SetTooltip("Show detailed performance information");
+
+ ImGui::Checkbox("Show Debug Info", &m_ShowDebugInfo);
+ if (ImGui::IsItemHovered())
+ ImGui::SetTooltip("Display debug information and statistics");
+
+ ImGui::Checkbox("Enable Anti-Aliasing", &m_EnableAntiAliasing);
+ 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* themeNames[] = { "Dark", "Light", "Blue" };
+ if (ImGui::Combo("UI Theme", &m_SelectedTheme, themeNames, IM_ARRAYSIZE(themeNames)))
+ ThemeManager::SetTheme(static_cast<Theme>(m_SelectedTheme));
+ if (ImGui::IsItemHovered())
+ ImGui::SetTooltip("Choose the application theme");
+
+ ImGui::EndChild();
+
+ ImGui::NextColumn();
+
+ ImGui::BeginChild("SimulationSettings", ImVec2(0, availableHeight), 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_ComputeHeight, 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_MaxStepsMoving, 1000, 60000, "%d");
+ if (ImGui::IsItemHovered())
+ ImGui::SetTooltip("Maximum ray marching steps when camera is moving");
+
+ ImGui::SliderInt("Max Steps (Static)", &m_MaxStepsStatic, 1000, 30000, "%d");
+ if (ImGui::IsItemHovered())
+ ImGui::SetTooltip("Maximum ray marching steps when camera is stationary");
+
+ ImGui::SliderFloat("Early Exit Distance", &m_EarlyExitDistance, 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_GravityEnabled);
+
+ ImGui::EndChild();
+
+ ImGui::Columns(1);
+
+ ImGui::Spacing();
+ ImGui::Separator();
+ ImGui::Spacing();
+
+ float buttonWidth = (ImGui::GetWindowWidth() - 80) / 4.0f;
+
+ if (ImGui::Button("Start Simulation", ImVec2(buttonWidth, 35)))
+ {
+ ApplySettings();
Application::Get().GetStateManager().SwitchToState("Simulation");
+ }
+
+ ImGui::SameLine();
+ if (ImGui::Button("Reset to Defaults", ImVec2(buttonWidth, 35)))
+ ResetToDefaults();
+
+ ImGui::SameLine();
+ if (ImGui::Button("Apply Settings", ImVec2(buttonWidth, 35)))
+ ApplySettings();
+
+ ImGui::SameLine();
+ if (ImGui::Button("Exit", ImVec2(buttonWidth, 35)))
+ Application::Get().Close();
+
+ if (m_ShowRestartMessage)
+ {
+ 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::ApplySettings()
+ {
+ RendererAPI::SetAPI(m_SelectedAPI);
+ DONUT_INFO("Settings applied");
+ }
+
+ void ConfigState::ResetToDefaults()
+ {
+ m_SelectedAPI = RendererAPI::API::OpenGL;
+ m_TargetFPS = 60;
+ m_ComputeHeight = 512;
+ m_MaxStepsMoving = 30000;
+ m_MaxStepsStatic = 15000;
+ m_EarlyExitDistance = 5e12f;
+ m_GravityEnabled = true;
+ m_VSyncEnabled = true;
+ m_ShowFPS = true;
+ m_ShowPerformanceMetrics = true;
+ m_ShowDebugInfo = false;
+ m_EnableAntiAliasing = true;
+ m_SelectedTheme = 0;
+
+ DONUT_INFO("Settings reset to defaults");
+ }
};
diff --git a/src/States/ConfigState.h b/src/States/ConfigState.h
index c54500c..baee8fa 100644
--- a/src/States/ConfigState.h
+++ b/src/States/ConfigState.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,30 @@ namespace Donut
void OnRender() override;
void OnImUIRender() override;
void OnEvent(Event& event) override;
+
+ private:
+ void ApplySettings();
+ void ResetToDefaults();
+
+ private:
+ RendererAPI::API m_SelectedAPI = RendererAPI::API::OpenGL;
+ bool m_ShowRestartMessage = false;
+ float m_RestartMessageTimer = 0.0f;
+
+ int m_TargetFPS = 60;
+ int m_ComputeHeight = 512;
+ int m_MaxStepsMoving = 30000;
+ int m_MaxStepsStatic = 15000;
+ float m_EarlyExitDistance = 5e12f;
+ bool m_GravityEnabled = true;
+
+ bool m_VSyncEnabled = true;
+ bool m_ShowFPS = true;
+ bool m_ShowPerformanceMetrics = true;
+ bool m_ShowDebugInfo = false;
+ bool m_EnableAntiAliasing = true;
+
+ // Theme settings
+ int m_SelectedTheme = 0; // 0=Dark, 1=Light, 2=Blue
};
}; \ No newline at end of file
diff --git a/src/States/SimulationState.cpp b/src/States/SimulationState.cpp
index 7a45bd1..87bf1ec 100644
--- a/src/States/SimulationState.cpp
+++ b/src/States/SimulationState.cpp
@@ -86,32 +86,36 @@ namespace Donut
void SimulationState::OnImUIRender()
{
- 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().GetStateManager().SwitchToState("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.GetWidth(), m_Engine.GetHeight());
- ImGui::Text("Compute Resolution: %dx%d", m_Engine.GetComputeWidth(), m_Engine.GetComputeHeight());
- ImGui::Text("Objects: %zu", m_Engine.GetObjects().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.GetCurrentFPS());
- ImGui::Text("Target FPS: %d", m_Engine.GetTargetFPS());
int targetFPS = m_Engine.GetTargetFPS();
if (ImGui::SliderInt("Target FPS", &targetFPS, 30, 120))
- {
m_Engine.SetTargetFPS(targetFPS);
- }
+
+ ImGui::Spacing();
+
+ ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Simulation Info");
+ ImGui::Separator();
+
+ ImGui::Text("Resolution: %dx%d", m_Engine.GetWidth(), m_Engine.GetHeight());
+ ImGui::Text("Compute Resolution: %dx%d", m_Engine.GetComputeWidth(), m_Engine.GetComputeHeight());
+ ImGui::Text("Objects: %zu", m_Engine.GetObjects().size());
int computeHeight = m_Engine.GetComputeHeight();
if (ImGui::SliderInt("Compute Height", &computeHeight, 64, 2048))
@@ -120,11 +124,13 @@ namespace Donut
m_Engine.UpdateComputeDimensions();
}
- ImGui::Text("Compute Width: %d (auto-calculated)", m_Engine.GetComputeWidth());
+ ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "Compute Width: %d (auto-calculated)", m_Engine.GetComputeWidth());
+ ImGui::Spacing();
+
+ ImGui::TextColored(ImVec4(0.9f, 0.9f, 1.0f, 1.0f), "Quality Settings");
ImGui::Separator();
- ImGui::Text("Simulation Quality:");
int maxStepsMoving = m_Engine.GetMaxStepsMoving();
if (ImGui::SliderInt("Max Steps (Moving)", &maxStepsMoving, 1000, 60000))
m_Engine.SetMaxStepsMoving(maxStepsMoving);
@@ -135,21 +141,19 @@ namespace Donut
if (ImGui::SliderFloat("Early Exit Distance", &earlyExitDistance, 1e11f, 1e13f, "%.2e"))
m_Engine.SetEarlyExitDistance(earlyExitDistance);
- 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.GetGravity();
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.GetCamera().GetOrbitalPosition().x,
m_Engine.GetCamera().GetOrbitalPosition().y,
@@ -158,6 +162,16 @@ namespace Donut
ImGui::Text("Azimuth: %.2f", m_Engine.GetCamera().GetAzimuth());
ImGui::Text("Elevation: %.2f", m_Engine.GetCamera().GetElevation());
+ 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();
}
};
diff --git a/src/main.cpp b/src/main.cpp
index 77fdff6..85554e4 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;
} \ No newline at end of file