Fix draw cache not redrawing after color picking

Also fix being able to draw when help window is open.
This commit is contained in:
Stephen Seo 2020-07-22 19:09:05 +09:00
parent a6517b8982
commit bcf94cd105
2 changed files with 8 additions and 1 deletions

View file

@ -25,6 +25,7 @@ namespace Tri {
ImGui::Begin("Help Window", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings); ImGui::Begin("Help Window", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings);
ImGui::Text("This is the help window - Press \"H\" to toggle this window"); 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("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 \"U\" to undo. Clicking will remove all future undo history");
ImGui::Text("Press \"R\" to undo."); ImGui::Text("Press \"R\" to undo.");
ImGui::Text("Press \"C\" to change colors"); ImGui::Text("Press \"C\" to change colors");

View file

@ -114,8 +114,14 @@ void Tri::State::handle_events() {
} }
} else if(event.key.code == sf::Keyboard::C) { } else if(event.key.code == sf::Keyboard::C) {
flags.flip(2); flags.flip(2);
if(!flags.test(2)) {
flags.set(7);
}
} else if(event.key.code == sf::Keyboard::B) { } else if(event.key.code == sf::Keyboard::B) {
flags.flip(5); flags.flip(5);
if(!flags.test(5)) {
flags.set(7);
}
} else if(event.key.code == sf::Keyboard::S) { } else if(event.key.code == sf::Keyboard::S) {
flags.flip(6); flags.flip(6);
} }
@ -302,5 +308,5 @@ void Tri::State::close_save() {
} }
bool Tri::State::is_in_clickable_menu() const { 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);
} }