SpiecsEngine
 
Loading...
Searching...
No Matches

◆ CenteredText()

void ImGui::CenteredText ( const char * label,
const ImVec2 & size_arg )

Draw a center text.

Parameters
[in]labelText.
[in]size_argText Size.

Definition at line 627 of file ImguiHelper.cpp.

628 {
629 ImGuiWindow* window = GetCurrentWindow();
630
631 ImGuiContext& g = *GImGui;
632 const ImGuiStyle& style = g.Style;
633 const ImGuiID id = window->GetID(label);
634 const ImVec2 label_size = CalcTextSize(label, NULL, true);
635
636 ImVec2 pos = window->DC.CursorPos;
637 ImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);
638
639 const ImVec2 pos2 = ImVec2((pos.x + size.x), (pos.y + size.y));
640 const ImRect bb(pos, pos2);
641
642 ItemSize(size, style.FramePadding.y);
643
644 const ImVec2 pos_min = ImVec2((bb.Min.x + style.FramePadding.x), (bb.Min.y + style.FramePadding.y));
645 const ImVec2 pos_max = ImVec2((bb.Max.x - style.FramePadding.x), (bb.Max.y - style.FramePadding.y));
646
647 RenderTextClipped(pos_min, pos_max, label, NULL, &label_size, style.ButtonTextAlign, &bb);
648 }