Updated bottom menu
This commit is contained in:
42
src/main.cpp
42
src/main.cpp
@ -45,6 +45,7 @@
|
||||
#include "core/Config.h"
|
||||
#include "core/Settings.h"
|
||||
#include "ui/MenuLayout.h"
|
||||
#include "ui/BottomMenu.h"
|
||||
|
||||
// Debug logging removed: no-op in this build (previously LOG_DEBUG)
|
||||
|
||||
@ -981,24 +982,30 @@ int main(int, char **)
|
||||
showSettingsPopup = false;
|
||||
} else {
|
||||
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;
|
||||
};
|
||||
auto menuInput = ui::handleBottomMenuInput(params, e, lx, ly, hoveredButton, true);
|
||||
hoveredButton = menuInput.hoveredIndex;
|
||||
|
||||
if (pointInRect(buttonRects[0])) {
|
||||
startMenuPlayTransition();
|
||||
} else if (pointInRect(buttonRects[1])) {
|
||||
requestStateFade(AppState::LevelSelector);
|
||||
} else if (pointInRect(buttonRects[2])) {
|
||||
requestStateFade(AppState::Options);
|
||||
} else if (pointInRect(buttonRects[3])) {
|
||||
// HELP - show inline help HUD in the MenuState
|
||||
if (menuState) menuState->showHelpPanel(true);
|
||||
} else if (pointInRect(buttonRects[4])) {
|
||||
showExitConfirmPopup = true;
|
||||
exitPopupSelectedButton = 1;
|
||||
if (menuInput.activated) {
|
||||
switch (*menuInput.activated) {
|
||||
case ui::BottomMenuItem::Play:
|
||||
startMenuPlayTransition();
|
||||
break;
|
||||
case ui::BottomMenuItem::Level:
|
||||
requestStateFade(AppState::LevelSelector);
|
||||
break;
|
||||
case ui::BottomMenuItem::Options:
|
||||
requestStateFade(AppState::Options);
|
||||
break;
|
||||
case ui::BottomMenuItem::Help:
|
||||
// HELP - show inline help HUD in the MenuState
|
||||
if (menuState) menuState->showHelpPanel(true);
|
||||
break;
|
||||
case ui::BottomMenuItem::Exit:
|
||||
showExitConfirmPopup = true;
|
||||
exitPopupSelectedButton = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Settings button (gear icon area - top right)
|
||||
@ -1099,7 +1106,8 @@ int main(int, char **)
|
||||
float contentOffsetX = (winW - contentW) * 0.5f / logicalScale;
|
||||
float contentOffsetY = (winH - contentH) * 0.5f / logicalScale;
|
||||
ui::MenuLayoutParams params{ LOGICAL_W, LOGICAL_H, winW, winH, logicalScale };
|
||||
hoveredButton = ui::hitTestMenuButtons(params, lx, ly);
|
||||
auto menuInput = ui::handleBottomMenuInput(params, e, lx, ly, hoveredButton, true);
|
||||
hoveredButton = menuInput.hoveredIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user