From bcf94cd10510ea4fc741d6d8a03530ae9ccc73eb Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Wed, 22 Jul 2020 19:09:05 +0900 Subject: [PATCH] Fix draw cache not redrawing after color picking Also fix being able to draw when help window is open. --- src/imgui_helper.hpp | 1 + src/state.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/imgui_helper.hpp b/src/imgui_helper.hpp index 394bb6e..57bb61a 100644 --- a/src/imgui_helper.hpp +++ b/src/imgui_helper.hpp @@ -25,6 +25,7 @@ namespace Tri { ImGui::Begin("Help Window", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings); ImGui::Text("This is the help window - Press \"H\" to toggle this window"); ImGui::Text("Click anywhere to create triangles, one point at a time"); + ImGui::Text("You cannot draw when a window is open"); ImGui::Text("Press \"U\" to undo. Clicking will remove all future undo history"); ImGui::Text("Press \"R\" to undo."); ImGui::Text("Press \"C\" to change colors"); diff --git a/src/state.cpp b/src/state.cpp index a249f67..829f5b5 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -114,8 +114,14 @@ void Tri::State::handle_events() { } } else if(event.key.code == sf::Keyboard::C) { flags.flip(2); + if(!flags.test(2)) { + flags.set(7); + } } else if(event.key.code == sf::Keyboard::B) { flags.flip(5); + if(!flags.test(5)) { + flags.set(7); + } } else if(event.key.code == sf::Keyboard::S) { flags.flip(6); } @@ -302,5 +308,5 @@ void Tri::State::close_save() { } bool Tri::State::is_in_clickable_menu() const { - return flags.test(2) || flags.test(5) || flags.test(6); + return flags.test(0) || flags.test(2) || flags.test(5) || flags.test(6); }