hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/states/simulation_state.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
commitf7334b82e8ab8b4a36847d7f9dd2a56f29dd0cbf (patch)
tree75cdf9b8bd802309ffc070a30af0fa72530b6d19 /src/states/simulation_state.cpp
parent8f906c3139a813b9a829821944b464b3facdad59 (diff)
feat: themes and better UI
Diffstat (limited to 'src/states/simulation_state.cpp')
-rw-r--r--src/states/simulation_state.cpp62
1 files changed, 38 insertions, 24 deletions
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();
}
};