aboutsummaryrefslogtreecommitdiff
path: root/src/States/SimulationState.cpp
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2025-08-16 17:36:57 +0200
committerhachem <im@hachem.wtf>2025-08-16 17:36:57 +0200
commit279e2378c1ef02e3917c29f8fafb39c058971577 (patch)
treee99af6bb415355bfc51c8be7bc7efb2c318998a1 /src/States/SimulationState.cpp
parent46ab589e5e1351f3081b5b4c76350967ef2f88a8 (diff)
[add]: Themes and better UI
Diffstat (limited to 'src/States/SimulationState.cpp')
-rw-r--r--src/States/SimulationState.cpp62
1 files changed, 38 insertions, 24 deletions
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();
}
};