Hello,
Just wondering how others have managed there GUI state when using ImGui, it seems as though you will end up with huge if else branches or switch cases to resolve the state of the dialog essentially a big state machine...
// WinForm
private void button1_Click(object sender, System.EventArgs e)
{
Stream myStream ;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
// Create a File
}
}
// My ImGui Guess
if (ImGui::BeginMainMenuBar())
{
if (ImGui::BeginMenu("File"))
{
if (ImGui::MenuItem("New"))
{
m_FileDialog.Open("New Project");
m_UIState = UIState::New_File_Dialog;
}
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Build"))
{
if (ImGui::MenuItem("Build"))
{
m_UIState = UIState::Build_Dialog;
}
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
// Current State, If Else or Switch etc?
if(m_UIState == UIState::New_File_Dialog)
{
// Do the New File dialog
if(m_FileDialog.ShowDialog() == DialogResult::OK)
{
// Create file.
}
}
else if (m_UIState == UIState::Build_Dialog)
{
// Do the Build Dialog
}
Thanks,