diff options
author | Aki <please@ignore.pl> | 2022-12-21 23:59:01 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-12-21 23:59:01 +0100 |
commit | 63c797a6a80c76b98dc1d11acf3b74f8ae67e7f3 (patch) | |
tree | 8b69fa9b2402ea44cd9a75168edc7ccadda5f0bd | |
parent | b6fd1823082cfa84993a70ba80243d3aa2f089f1 (diff) | |
download | kurator-63c797a6a80c76b98dc1d11acf3b74f8ae67e7f3.zip kurator-63c797a6a80c76b98dc1d11acf3b74f8ae67e7f3.tar.gz kurator-63c797a6a80c76b98dc1d11acf3b74f8ae67e7f3.tar.bz2 |
Made controls window a bit fancier
-rw-r--r-- | kurator/src/Battle.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kurator/src/Battle.cpp b/kurator/src/Battle.cpp index 9ec2bdd..6c86c25 100644 --- a/kurator/src/Battle.cpp +++ b/kurator/src/Battle.cpp @@ -2,6 +2,7 @@ #include <algorithm> #include <cmath> +#include <limits> #include <memory> #include <string> #include <utility> @@ -72,8 +73,16 @@ Battle::update(const float dt) pop.speed.y -= damp.y; } balance.update(registry); - ImGui::Begin("Controls"); - ImGui::SliderFloat("Time Factor", &time_factor, 0.1f, 3.0f); + ImGui::SetNextWindowPos({GetScreenWidth()/2.0f, GetScreenHeight()-100.0f}, ImGuiCond_Once, {0.5f, 0.5f}); + ImGui::SetNextWindowSize({240.0f, 0.0f}, ImGuiCond_Once); + if (ImGui::Begin("Controls", nullptr, ImGuiWindowFlags_NoFocusOnAppearing)) { + ImGui::PushItemWidth(-std::numeric_limits<float>::min()); + if (ImGui::Button("1x")) + time_factor = 1.0f; + ImGui::SameLine(); + ImGui::SliderFloat("##time_factor", &time_factor, 0.1f, 10.0f); + ImGui::PopItemWidth(); + } ImGui::End(); if (IsKeyPressed(KEY_SPACE)) session->set(std::make_shared<Log>(session, log)); |