Skip to content

Commit

Permalink
FSUI: Don't move IMGUI cursor unnecessarily in DrawGameGrid()
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastRar authored and lightningterror committed Nov 4, 2024
1 parent b95eb5c commit e57f7d9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pcsx2/ImGui/FullscreenUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6224,13 +6224,23 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)
SmallString draw_title;

u32 grid_x = 0;
ImGui::SetCursorPos(ImVec2(start_x, 0.0f));
for (const GameList::Entry* entry : s_game_list_sorted_entries)
{
ImGuiWindow* window = ImGui::GetCurrentWindow();
if (window->SkipItems)
continue;

if (grid_x == grid_count_x)
{
grid_x = 0;
ImGui::SetCursorPosX(start_x);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + item_spacing);
}
else
{
ImGui::SameLine(start_x + static_cast<float>(grid_x) * (item_width + item_spacing));
}

const ImGuiID id = window->GetID(entry->path.c_str(), entry->path.c_str() + entry->path.length());
const ImVec2 pos(window->DC.CursorPos);
ImRect bb(pos, pos + item_size);
Expand Down Expand Up @@ -6283,16 +6293,6 @@ void FullscreenUI::DrawGameGrid(const ImVec2& heading_size)
}

grid_x++;
if (grid_x == grid_count_x)
{
grid_x = 0;
ImGui::SetCursorPosX(start_x);
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + item_spacing);
}
else
{
ImGui::SameLine(start_x + static_cast<float>(grid_x) * (item_width + item_spacing));
}
}

EndMenuButtons();
Expand Down

0 comments on commit e57f7d9

Please sign in to comment.