MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / RenderArrow

Method RenderArrow

KBotExt/imgui/imgui_draw.cpp:3812–3841  ·  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

3810
3811// 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
3812void ImGui::RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale)
3813{
3814 const float h = draw_list->_Data->FontSize * 1.00f;
3815 float r = h * 0.40f * scale;
3816 ImVec2 center = pos + ImVec2(h * 0.50f, h * 0.50f * scale);
3817
3818 ImVec2 a, b, c;
3819 switch (dir)
3820 {
3821 case ImGuiDir_Up:
3822 case ImGuiDir_Down:
3823 if (dir == ImGuiDir_Up) r = -r;
3824 a = ImVec2(+0.000f, +0.750f) * r;
3825 b = ImVec2(-0.866f, -0.750f) * r;
3826 c = ImVec2(+0.866f, -0.750f) * r;
3827 break;
3828 case ImGuiDir_Left:
3829 case ImGuiDir_Right:
3830 if (dir == ImGuiDir_Left) r = -r;
3831 a = ImVec2(+0.750f, +0.000f) * r;
3832 b = ImVec2(-0.750f, +0.866f) * r;
3833 c = ImVec2(-0.750f, -0.866f) * r;
3834 break;
3835 case ImGuiDir_None:
3836 case ImGuiDir_COUNT:
3837 IM_ASSERT(0);
3838 break;
3839 }
3840 draw_list->AddTriangleFilled(center + a, center + b, center + c, col);
3841}
3842
3843void ImGui::RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col)
3844{

Callers

nothing calls this directly

Calls 2

ImVec2Function · 0.85
AddTriangleFilledMethod · 0.80

Tested by

no test coverage detected