1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-12-01 02:37:24 +01:00

ShowTestWindow(): more examples of SameLine() usage

This commit is contained in:
ocornut 2015-03-18 00:07:21 +00:00
parent 9c489a081c
commit 2a9a2918f8

View File

@ -9369,10 +9369,15 @@ void ImGui::ShowTestWindow(bool* opened)
ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceeding item)"); ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceeding item)");
// Text // Text
ImGui::Text("Hello"); ImGui::Text("Two items: Hello");
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextColored(ImVec4(1,1,0,1), "World"); ImGui::TextColored(ImVec4(1,1,0,1), "World");
// Adjust spacing
ImGui::Text("More spacing: Hello");
ImGui::SameLine(0, 20);
ImGui::TextColored(ImVec4(1,1,0,1), "World");
// Button // Button
ImGui::AlignFirstTextHeightToWidgets(); ImGui::AlignFirstTextHeightToWidgets();
ImGui::Text("Normal buttons"); ImGui::SameLine(); ImGui::Text("Normal buttons"); ImGui::SameLine();
@ -9385,6 +9390,14 @@ void ImGui::ShowTestWindow(bool* opened)
ImGui::SmallButton("Like this one"); ImGui::SameLine(); ImGui::SmallButton("Like this one"); ImGui::SameLine();
ImGui::Text("can fit within a text block."); ImGui::Text("can fit within a text block.");
// Aligned to arbitrary position. Easy/cheap column.
ImGui::Text("Aligned");
ImGui::SameLine(150); ImGui::Text("x=150");
ImGui::SameLine(300); ImGui::Text("x=300");
ImGui::Text("Aligned");
ImGui::SameLine(150); ImGui::SmallButton("x=150");
ImGui::SameLine(300); ImGui::SmallButton("x=300");
// Checkbox // Checkbox
static bool c1=false,c2=false,c3=false,c4=false; static bool c1=false,c2=false,c3=false,c4=false;
ImGui::Checkbox("My", &c1); ImGui::SameLine(); ImGui::Checkbox("My", &c1); ImGui::SameLine();