paterns_menu: Move it to it's own class

This commit is contained in:
2026-01-13 14:49:12 +01:00
parent 55341973b3
commit 81f1bc5e72
8 changed files with 70 additions and 19 deletions

View File

@@ -12,19 +12,13 @@
#include <control_menu.hpp>
#include <settings_menu.hpp>
#include <paterns_menu.hpp>
#include <world.hpp>
#include <rules.hpp>
namespace gol {
ControlMenu::ControlMenu(std::shared_ptr<ctx> context):context_(context) {
play_ctrl_ = true;
step_ctrl_ = false;
step_back_ctrl_ = false;
rand_ctrl_ = false;
edit_ctrl_ = false;
clear_ctrl_ = false;
paterns_ctrl_ = false;
}
void ControlMenu::update() {
@@ -82,8 +76,8 @@ void ControlMenu::display() {
ImGui::Checkbox("Edit", &edit_ctrl_);
ImGui::Checkbox("Clear", &clear_ctrl_);
ImGui::Checkbox("Randomize", &rand_ctrl_);
if (ImGui::Button((paterns_ctrl_) ? "Hide paterns" : "Show paterns")) {
paterns_ctrl_ = !paterns_ctrl_;
if (ImGui::Button((context_->paterns_menu->isOpen()) ? "Hide paterns" : "Show paterns")) {
context_->paterns_menu->Toogle();
}
if (ImGui::Button((context_->settings_menu->isOpen()) ? "Hide settings" : "Show settings")) {
context_->settings_menu->Toogle();