added helper menu

This commit is contained in:
2025-11-30 13:30:02 +01:00
parent 588f870b26
commit 55c40f0516
11 changed files with 272 additions and 26 deletions

View File

@ -465,8 +465,7 @@ void MenuState::render(SDL_Renderer* renderer, float logicalScale, SDL_Rect logi
ctx.font->draw(renderer, popupX + 140, popupY + 100, "ON", 1.5f, SDL_Color{0,255,0,255});
ctx.font->draw(renderer, popupX + 20, popupY + 150, "M = TOGGLE MUSIC", 1.0f, SDL_Color{200,200,220,255});
ctx.font->draw(renderer, popupX + 20, popupY + 170, "S = TOGGLE SOUND FX", 1.0f, SDL_Color{200,200,220,255});
ctx.font->draw(renderer, popupX + 20, popupY + 190, "N = PLAY LETS_GO", 1.0f, SDL_Color{200,200,220,255});
ctx.font->draw(renderer, popupX + 20, popupY + 210, "ESC = CLOSE", 1.0f, SDL_Color{200,200,220,255});
ctx.font->draw(renderer, popupX + 20, popupY + 190, "ESC = CLOSE", 1.0f, SDL_Color{200,200,220,255});
}
// Trace exit
{

View File

@ -104,8 +104,7 @@ void PlayingState::handleEvent(const SDL_Event& e) {
// Tetris controls (only when not paused)
if (!ctx.game->isPaused()) {
// Rotation (still event-based for precise timing)
if (e.key.scancode == SDL_SCANCODE_UP || e.key.scancode == SDL_SCANCODE_W ||
e.key.scancode == SDL_SCANCODE_Z) {
if (e.key.scancode == SDL_SCANCODE_UP) {
ctx.game->rotate(1); // Clockwise rotation
return;
}

View File

@ -49,6 +49,7 @@ struct StateContext {
int* hoveredButton = nullptr;
// Menu popups (exposed from main)
bool* showSettingsPopup = nullptr;
bool* showHelpOverlay = nullptr;
bool* showExitConfirmPopup = nullptr; // If true, show "Exit game?" confirmation while playing
int* exitPopupSelectedButton = nullptr; // 0 = YES, 1 = NO (default)
bool* gameplayCountdownActive = nullptr; // True if start-of-game countdown is running