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

Method RenderMouseCursor

ImGUI GLFW Tutorial/imgui/imgui_draw.cpp:3768–3787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3766}
3767
3768void ImGui::RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
3769{
3770 if (mouse_cursor == ImGuiMouseCursor_None)
3771 return;
3772 IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);
3773
3774 ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas;
3775 ImVec2 offset, size, uv[4];
3776 if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2]))
3777 {
3778 pos -= offset;
3779 ImTextureID tex_id = font_atlas->TexID;
3780 draw_list->PushTextureID(tex_id);
3781 draw_list->AddImage(tex_id, pos + ImVec2(1, 0) * scale, pos + (ImVec2(1, 0) + size) * scale, uv[2], uv[3], col_shadow);
3782 draw_list->AddImage(tex_id, pos + ImVec2(2, 0) * scale, pos + (ImVec2(2, 0) + size) * scale, uv[2], uv[3], col_shadow);
3783 draw_list->AddImage(tex_id, pos, pos + size * scale, uv[2], uv[3], col_border);
3784 draw_list->AddImage(tex_id, pos, pos + size * scale, uv[0], uv[1], col_fill);
3785 draw_list->PopTextureID();
3786 }
3787}
3788
3789// 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.
3790void ImGui::RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)

Callers

nothing calls this directly

Calls 5

ImVec2Function · 0.70
GetMouseCursorTexDataMethod · 0.45
PushTextureIDMethod · 0.45
AddImageMethod · 0.45
PopTextureIDMethod · 0.45

Tested by

no test coverage detected