MCPcopy Create free account
hub / github.com/RenderKit/embree / BulletTextV

Method BulletTextV

tutorials/common/imgui/imgui_widgets.cpp:389–413  ·  view source on GitHub ↗

Text with a little bullet aligned to the typical tree node.

Source from the content-addressed store, hash-verified

387
388// Text with a little bullet aligned to the typical tree node.
389void ImGui::BulletTextV(const char* fmt, va_list args)
390{
391 ImGuiWindow* window = GetCurrentWindow();
392 if (window->SkipItems)
393 return;
394
395 ImGuiContext& g = *GImGui;
396 const ImGuiStyle& style = g.Style;
397
398 const char* text_begin, *text_end;
399 ImFormatStringToTempBufferV(&text_begin, &text_end, fmt, args);
400 const ImVec2 label_size = CalcTextSize(text_begin, text_end, false);
401 const ImVec2 total_size = ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x * 2) : 0.0f), label_size.y); // Empty text doesn't add padding
402 ImVec2 pos = window->DC.CursorPos;
403 pos.y += window->DC.CurrLineTextBaseOffset;
404 ItemSize(total_size, 0.0f);
405 const ImRect bb(pos, pos + total_size);
406 if (!ItemAdd(bb, 0))
407 return;
408
409 // Render
410 ImU32 text_col = GetColorU32(ImGuiCol_Text);
411 RenderBullet(window->DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, g.FontSize * 0.5f), text_col);
412 RenderText(bb.Min + ImVec2(g.FontSize + style.FramePadding.x * 2, 0.0f), text_begin, text_end, false);
413}
414
415//-------------------------------------------------------------------------
416// [SECTION] Widgets: Main

Callers

nothing calls this directly

Calls 4

GetCurrentWindowFunction · 0.85
ImVec2Function · 0.85
ItemSizeFunction · 0.85

Tested by

no test coverage detected