MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / BulletTextV

Method BulletTextV

ImGUI GLFW Tutorial/imgui/imgui_widgets.cpp:382–406  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

380
381// Text with a little bullet aligned to the typical tree node.
382void ImGui::BulletTextV(const char* fmt, va_list args)
383{
384 ImGuiWindow* window = GetCurrentWindow();
385 if (window->SkipItems)
386 return;
387
388 ImGuiContext& g = *GImGui;
389 const ImGuiStyle& style = g.Style;
390
391 const char* text_begin = g.TempBuffer;
392 const char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);
393 const ImVec2 label_size = CalcTextSize(text_begin, text_end, false);
394 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
395 ImVec2 pos = window->DC.CursorPos;
396 pos.y += window->DC.CurrLineTextBaseOffset;
397 ItemSize(total_size, 0.0f);
398 const ImRect bb(pos, pos + total_size);
399 if (!ItemAdd(bb, 0))
400 return;
401
402 // Render
403 ImU32 text_col = GetColorU32(ImGuiCol_Text);
404 RenderBullet(window->DrawList, bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, g.FontSize * 0.5f), text_col);
405 RenderText(bb.Min + ImVec2(g.FontSize + style.FramePadding.x * 2, 0.0f), text_begin, text_end, false);
406}
407
408//-------------------------------------------------------------------------
409// [SECTION] Widgets: Main

Callers

nothing calls this directly

Calls 4

GetCurrentWindowFunction · 0.70
ImFormatStringVFunction · 0.70
ImVec2Function · 0.70
RenderBulletFunction · 0.70

Tested by

no test coverage detected