From 2a9a2918f84f7820b2218e4f80ee5ff7cc86db23 Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 18 Mar 2015 00:07:21 +0000 Subject: [PATCH] ShowTestWindow(): more examples of SameLine() usage --- imgui.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 428552eb..1ed7d6c1 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -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)"); // Text - ImGui::Text("Hello"); + ImGui::Text("Two items: Hello"); ImGui::SameLine(); 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 ImGui::AlignFirstTextHeightToWidgets(); ImGui::Text("Normal buttons"); ImGui::SameLine(); @@ -9385,6 +9390,14 @@ void ImGui::ShowTestWindow(bool* opened) ImGui::SmallButton("Like this one"); ImGui::SameLine(); 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 static bool c1=false,c2=false,c3=false,c4=false; ImGui::Checkbox("My", &c1); ImGui::SameLine();