create toogable window
This commit is contained in:
13
src/main.cpp
13
src/main.cpp
@@ -108,6 +108,7 @@ int main(int ac, char **av) {
|
|||||||
bool edit_ctrl = false;
|
bool edit_ctrl = false;
|
||||||
bool clear_ctrl = false;
|
bool clear_ctrl = false;
|
||||||
bool settings_window = false;
|
bool settings_window = false;
|
||||||
|
bool paterns_ctrl = false;
|
||||||
int width_ctrl = config_json["screen_width"].get<int>();
|
int width_ctrl = config_json["screen_width"].get<int>();
|
||||||
int height_ctrl = config_json["screen_height"].get<int>();
|
int height_ctrl = config_json["screen_height"].get<int>();
|
||||||
bool dark_theme_ctrl = config_json["dark_theme"].get<bool>();
|
bool dark_theme_ctrl = config_json["dark_theme"].get<bool>();
|
||||||
@@ -281,12 +282,22 @@ int main(int ac, char **av) {
|
|||||||
ImGui::Checkbox("Edit", &edit_ctrl);
|
ImGui::Checkbox("Edit", &edit_ctrl);
|
||||||
ImGui::Checkbox("Clear", &clear_ctrl);
|
ImGui::Checkbox("Clear", &clear_ctrl);
|
||||||
ImGui::Checkbox("Randomize", &rand_ctrl);
|
ImGui::Checkbox("Randomize", &rand_ctrl);
|
||||||
|
if (ImGui::Button((paterns_ctrl) ? "Hide paterns" : "Show paterns")) {
|
||||||
|
paterns_ctrl = !paterns_ctrl;
|
||||||
|
}
|
||||||
if (ImGui::Button((settings_window) ? "Hide settings" : "Show settings")) {
|
if (ImGui::Button((settings_window) ? "Hide settings" : "Show settings")) {
|
||||||
settings_window = !settings_window;
|
settings_window = !settings_window;
|
||||||
}
|
}
|
||||||
ImGui::Text("Generation: %zu", world.getCycle());
|
ImGui::Text("Generation: %zu", world.getCycle());
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
if (paterns_ctrl) {
|
||||||
|
ImGuiWindowFlags paterns_flags =
|
||||||
|
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize;
|
||||||
|
ImGui::SetNextWindowSize(ImVec2(150, 200), ImGuiCond_Always);
|
||||||
|
ImGui::Begin("paterns", &paterns_ctrl, paterns_flags);
|
||||||
|
ImGui::Button("refresh");
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
if (settings_window) {
|
if (settings_window) {
|
||||||
ImGuiWindowFlags settings_flags =
|
ImGuiWindowFlags settings_flags =
|
||||||
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize;
|
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize;
|
||||||
|
|||||||
Reference in New Issue
Block a user