MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / RenderMouseCursor

Method RenderMouseCursor

plugins/Cardinal/src/DearImGui/imgui_draw.cpp:3800–3819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3798}
3799
3800void ImGui::RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
3801{
3802 if (mouse_cursor == ImGuiMouseCursor_None)
3803 return;
3804 IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);
3805
3806 ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas;
3807 ImVec2 offset, size, uv[4];
3808 if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2]))
3809 {
3810 pos -= offset;
3811 ImTextureID tex_id = font_atlas->TexID;
3812 draw_list->PushTextureID(tex_id);
3813 draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale, uv[2], uv[3], col_shadow);
3814 draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv[2], uv[3], col_shadow);
3815 draw_list->AddImage(tex_id, pos, pos + size * scale, uv[2], uv[3], col_border);
3816 draw_list->AddImage(tex_id, pos, pos + size * scale, uv[0], uv[1], col_fill);
3817 draw_list->PopTextureID();
3818 }
3819}
3820
3821// Render an arrow. 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.
3822void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)

Callers

nothing calls this directly

Calls 5

ImVec2Function · 0.85
GetMouseCursorTexDataMethod · 0.80
PushTextureIDMethod · 0.80
AddImageMethod · 0.80
PopTextureIDMethod · 0.80

Tested by

no test coverage detected