feat(renderer): polish gameplay visuals — transport, starfield, sparkles, smooth piece motion
Add transport/transfer effect for NEXT → grid with cross-fade and preview swap Integrate in-grid Starfield3D with magnet targeting tied to active piece Spawn ambient sparkles and impact sparks (hard-drop crackle + burst on expiry) Smooth horizontal/fall interpolation for active piece (configurable smooth scroll) Refactor next panel / preview rendering and connector drawing Tweak stats/score panel layout, progress bars and typography for compact view Preserve safe alpha handling and restore renderer blend/scale state after overlays
This commit is contained in:
31
src/main.cpp
31
src/main.cpp
@ -1039,7 +1039,8 @@ int main(int, char **)
|
||||
SoundEffectManager::instance().setEnabled(!SoundEffectManager::instance().isEnabled());
|
||||
Settings::instance().setSoundEnabled(SoundEffectManager::instance().isEnabled());
|
||||
}
|
||||
if (e.key.scancode == SDL_SCANCODE_H && state != AppState::Loading)
|
||||
// Disable H-help shortcut on the main menu; keep it elsewhere
|
||||
if (e.key.scancode == SDL_SCANCODE_H && state != AppState::Loading && state != AppState::Menu)
|
||||
{
|
||||
showHelpOverlay = !showHelpOverlay;
|
||||
if (state == AppState::Playing) {
|
||||
@ -1058,6 +1059,25 @@ int main(int, char **)
|
||||
helpOverlayPausedGame = false;
|
||||
}
|
||||
}
|
||||
// If help overlay is visible and the user presses ESC, close help and return to Menu
|
||||
if (e.key.scancode == SDL_SCANCODE_ESCAPE && showHelpOverlay) {
|
||||
showHelpOverlay = false;
|
||||
helpOverlayPausedGame = false;
|
||||
// Unpause game if we paused it for the overlay
|
||||
if (state == AppState::Playing) {
|
||||
if (game.isPaused() && !helpOverlayPausedGame) {
|
||||
// If paused for other reasons, avoid overriding; otherwise ensure unpaused
|
||||
// (The flag helps detect pause because of help overlay.)
|
||||
}
|
||||
}
|
||||
if (state != AppState::Menu && ctx.requestFadeTransition) {
|
||||
// Request a transition back to the Menu state
|
||||
ctx.requestFadeTransition(AppState::Menu);
|
||||
} else if (state != AppState::Menu && ctx.stateManager) {
|
||||
state = AppState::Menu;
|
||||
ctx.stateManager->setState(state);
|
||||
}
|
||||
}
|
||||
if (e.key.key == SDLK_F11 || (e.key.key == SDLK_RETURN && (e.key.mod & SDL_KMOD_ALT)))
|
||||
{
|
||||
isFullscreen = !isFullscreen;
|
||||
@ -1160,9 +1180,9 @@ int main(int, char **)
|
||||
const float btnYOffset = 40.0f; // must match MenuState offset
|
||||
float btnCY = LOGICAL_H * 0.86f + contentOffsetY + btnYOffset;
|
||||
float spacing = isSmall ? btnW * 1.15f : btnW * 1.05f;
|
||||
std::array<SDL_FRect, 4> buttonRects{};
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
float center = btnCX + (static_cast<float>(i) - 1.5f) * spacing;
|
||||
std::array<SDL_FRect, 5> buttonRects{};
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
float center = btnCX + (static_cast<float>(i) - 2.0f) * spacing;
|
||||
buttonRects[i] = SDL_FRect{center - btnW / 2.0f, btnCY - btnH / 2.0f, btnW, btnH};
|
||||
}
|
||||
|
||||
@ -1177,6 +1197,9 @@ int main(int, char **)
|
||||
} 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user