0

I'm using glfw with glad and imgui to create a launcher for my game engine. Currently this is the bit that does all of the imgui stuff:

bool projects = true;
bool versions = false;

ImGui::Begin("Tabs", 0, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);
        
if (ImGui::Button("Projects"))
{
    projects = true;
    versions = false;
}
if (ImGui::Button("Editor Versions"))
{
    projects = false;
    versions = true;
}

ImGui::End();

if (projects)
{
   ImGui::Begin("Projects", &projects, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);

    ImGui::End(); 
}

if (versions)
{
    ImGui::Begin("Versions", &versions, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);

    ImGui::End();
}

I'm trying to make it so that when you click Editor Versions, it closes Projects and opens Versions and the other way around for Projects

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Sebwazhere
  • 13
  • 3
  • and .. it doesn't? what happens instead? – Botje Mar 10 '23 at 19:34
  • @Botje well there should be a difference in the name, they're at the same size and position as I modified imgui.ini, but when I click on the buttons it still says projects instead of versions. – Sebwazhere Mar 10 '23 at 20:40

1 Answers1

1

I figured out the issue, I defined the variables in the loop! So they just kept on resetting to their default values. All I had to do was move it out of the while (!glfwWindowShouldClose(window)) loop

Sebwazhere
  • 13
  • 3