fixed menu

This commit is contained in:
2025-12-17 18:55:55 +01:00
parent cecf5cf68e
commit a671825502
5 changed files with 124 additions and 88 deletions

View File

@ -980,18 +980,8 @@ int main(int, char **)
// Click anywhere closes settings popup
showSettingsPopup = false;
} else {
// Responsive Main menu buttons (match MenuState layout)
bool isSmall = ((LOGICAL_W * logicalScale) < MENU_SMALL_THRESHOLD);
float btnW = isSmall ? (LOGICAL_W * MENU_BTN_WIDTH_SMALL_FACTOR) : MENU_BTN_WIDTH_LARGE;
float btnH = isSmall ? MENU_BTN_HEIGHT_SMALL : MENU_BTN_HEIGHT_LARGE;
float btnCX = LOGICAL_W * 0.5f + contentOffsetX;
float btnCY = LOGICAL_H * 0.86f + contentOffsetY + MENU_BTN_Y_OFFSET;
float spacing = isSmall ? btnW * MENU_BTN_SPACING_FACTOR_SMALL : btnW * MENU_BTN_SPACING_FACTOR_LARGE;
std::array<SDL_FRect, MENU_BTN_COUNT> buttonRects{};
for (int i = 0; i < MENU_BTN_COUNT; ++i) {
float center = btnCX + (static_cast<float>(i) - MENU_BTN_CENTER) * spacing;
buttonRects[i] = SDL_FRect{center - btnW / 2.0f, btnCY - btnH / 2.0f, btnW, btnH};
}
ui::MenuLayoutParams params{ LOGICAL_W, LOGICAL_H, winW, winH, logicalScale };
auto buttonRects = ui::computeMenuButtonRects(params);
auto pointInRect = [&](const SDL_FRect& r) {
return lx >= r.x && lx <= r.x + r.w && ly >= r.y && ly <= r.y + r.h;