MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / RenderNavCursor

Method RenderNavCursor

3rdparty/imgui/src/imgui.cpp:4024–4059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4022}
4023
4024void ImGui::RenderNavCursor(const ImRect& bb, ImGuiID id, ImGuiNavRenderCursorFlags flags)
4025{
4026 ImGuiContext& g = *GImGui;
4027 if (id != g.NavId)
4028 return;
4029 if (!g.NavCursorVisible && !(flags & ImGuiNavRenderCursorFlags_AlwaysDraw))
4030 return;
4031 if (id == g.LastItemData.ID && (g.LastItemData.ItemFlags & ImGuiItemFlags_NoNav))
4032 return;
4033
4034 // We don't early out on 'window->Flags & ImGuiWindowFlags_NoNavInputs' because it would be inconsistent with
4035 // other code directly checking NavCursorVisible. Instead we aim for NavCursorVisible to always be false.
4036 ImGuiWindow* window = g.CurrentWindow;
4037 if (window->DC.NavHideHighlightOneFrame)
4038 return;
4039
4040 float rounding = (flags & ImGuiNavRenderCursorFlags_NoRounding) ? 0.0f : g.Style.FrameRounding;
4041 ImRect display_rect = bb;
4042 display_rect.ClipWith(window->ClipRect);
4043 const float thickness = 2.0f;
4044 if (flags & ImGuiNavRenderCursorFlags_Compact)
4045 {
4046 window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavCursor), rounding, thickness);
4047 }
4048 else
4049 {
4050 const float distance = 3.0f + thickness * 0.5f;
4051 display_rect.Expand(ImVec2(distance, distance));
4052 bool fully_visible = window->ClipRect.Contains(display_rect);
4053 if (!fully_visible)
4054 window->DrawList->PushClipRect(display_rect.Min, display_rect.Max);
4055 window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavCursor), rounding, thickness);
4056 if (!fully_visible)
4057 window->DrawList->PopClipRect();
4058 }
4059}
4060
4061void ImGui::RenderMouseCursor(ImVec2 base_pos, float base_scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
4062{

Callers

nothing calls this directly

Calls 6

ImVec2Function · 0.50
AddRectMethod · 0.45
ExpandMethod · 0.45
ContainsMethod · 0.45
PushClipRectMethod · 0.45
PopClipRectMethod · 0.45

Tested by

no test coverage detected