MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / RenderArrow

Method RenderArrow

extern/imgui/imgui_draw.cpp:3765–3794  ·  view source on GitHub ↗

Render an arrow aimed to be aligned with text (p_min is a position in the same space text would be positioned). To e.g. denote expanded/collapsed state

Source from the content-addressed store, hash-verified

3763
3764// Render an arrow aimed to be aligned with text (p_min is a position in the same space text would be positioned). To e.g. denote expanded/collapsed state
3765void ImGui::RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale)
3766{
3767 const float h = draw_list->_Data->FontSize * 1.00f;
3768 float r = h * 0.40f * scale;
3769 ImVec2 center = pos + ImVec2(h * 0.50f, h * 0.50f * scale);
3770
3771 ImVec2 a, b, c;
3772 switch (dir)
3773 {
3774 case ImGuiDir_Up:
3775 case ImGuiDir_Down:
3776 if (dir == ImGuiDir_Up) r = -r;
3777 a = ImVec2(+0.000f, +0.750f) * r;
3778 b = ImVec2(-0.866f, -0.750f) * r;
3779 c = ImVec2(+0.866f, -0.750f) * r;
3780 break;
3781 case ImGuiDir_Left:
3782 case ImGuiDir_Right:
3783 if (dir == ImGuiDir_Left) r = -r;
3784 a = ImVec2(+0.750f, +0.000f) * r;
3785 b = ImVec2(-0.750f, +0.866f) * r;
3786 c = ImVec2(-0.750f, -0.866f) * r;
3787 break;
3788 case ImGuiDir_None:
3789 case ImGuiDir_COUNT:
3790 IM_ASSERT(0);
3791 break;
3792 }
3793 draw_list->AddTriangleFilled(center + a, center + b, center + c, col);
3794}
3795
3796void ImGui::RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col)
3797{

Callers

nothing calls this directly

Calls 2

ImVec2Function · 0.85
AddTriangleFilledMethod · 0.80

Tested by

no test coverage detected