ShowTestWindow(): more examples of SameLine() usage

docking
ocornut 10 years ago
parent 9c489a081c
commit 2a9a2918f8

@ -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();

Loading…
Cancel
Save