This commit is contained in:
2025-12-19 16:48:26 +01:00
parent 989b98002c
commit fe0cd289e2
3 changed files with 34 additions and 20 deletions

View File

@ -1314,14 +1314,15 @@ void MenuState::render(SDL_Renderer* renderer, float logicalScale, SDL_Rect logi
}
};
float leftCursor = panelY + 48.0f - static_cast<float>(helpScroll);
float rightCursor = panelY + 48.0f - static_cast<float>(helpScroll);
const float contentTopY = panelY + 30.0f;
float leftCursor = contentTopY - static_cast<float>(helpScroll);
float rightCursor = contentTopY - static_cast<float>(helpScroll);
drawSection(leftX, leftCursor, "GENERAL", generalShortcuts, (int)(sizeof(generalShortcuts)/sizeof(generalShortcuts[0])));
drawSection(leftX, leftCursor, "MENUS", menuShortcuts, (int)(sizeof(menuShortcuts)/sizeof(menuShortcuts[0])));
drawSection(rightX, rightCursor, "GAMEPLAY", gameplayShortcuts, (int)(sizeof(gameplayShortcuts)/sizeof(gameplayShortcuts[0])));
// Ensure helpScroll bounds (simple clamp)
float contentHeight = std::max(leftCursor, rightCursor) - (panelY + 48.0f);
float contentHeight = std::max(leftCursor, rightCursor) - contentTopY;
float maxScroll = std::max(0.0f, contentHeight - (PH - 120.0f));
if (helpScroll < 0.0) helpScroll = 0.0;
if (helpScroll > maxScroll) helpScroll = maxScroll;