Examples: Tweaked the main.cpp example structure for all examples. (There are a few hidden agendas here: 1) I would like to avoid encouraging people from using the implicit "Debug" window, and promote using Begin/End. In spite of my best attempt, there are a few feature of the upcoming docking system that cannot work 100% properly for the implicit Debug window, so future proof let's not put that feature in the spotlight too much for new users. 2) Moved dumb hardcoded positions into a single spot that can be replaced with a viewport relative position and not affect other demo windows. 3) Calling ShowDemoWindow before anything else, also for the benefit of a specific docking demo which will have an ordering constraint which is not really problematic in a real app but shouldn't be put forward in the demo.
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
if (ImGui::Button("Close Me"))
show_another_window = false;
show_another_window = false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
// Rendering
if (show_demo_window)
{
// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway.
// Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if (ImGui::Button("Close Me"))
if (ImGui::Button("Close Me"))
show_another_window = false;
show_another_window = false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if (show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
if(ImGui::Button("Close Me"))
show_another_window=false;
show_another_window=false;
ImGui::End();
ImGui::End();
}
}
// 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui!
if(show_demo_window)
{
ImGui::SetNextWindowPos(ImVec2(650,20),ImGuiCond_FirstUseEver);// Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
if(no_close)p_open=NULL;// Don't pass our bool* to Begin
if(no_close)p_open=NULL;// Don't pass our bool* to Begin
// We specify a default size in case there's no data in the .ini file. Typically this isn't required! We only do it to make the Demo applications a little more welcoming.
// We specify a default position/size in case there's no data in the .ini file. Typically this isn't required! We only do it to make the Demo applications a little more welcoming.