smooth scroll added

This commit is contained in:
2025-11-30 09:30:50 +01:00
parent 8279ccbe6d
commit 8b350bfb9e
6 changed files with 77 additions and 6 deletions

View File

@ -103,6 +103,24 @@ void Game::setPaused(bool p) {
paused = p;
}
void Game::setSoftDropping(bool on) {
if (softDropping == on) {
return;
}
double oldStep = softDropping ? (gravityMs / 5.0) : gravityMs;
softDropping = on;
double newStep = softDropping ? (gravityMs / 5.0) : gravityMs;
if (oldStep <= 0.0 || newStep <= 0.0) {
return;
}
double progress = fallAcc / oldStep;
progress = std::clamp(progress, 0.0, 1.0);
fallAcc = progress * newStep;
}
void Game::refillBag() {
bag.clear();
for (int i=0;i<PIECE_COUNT;++i) bag.push_back(static_cast<PieceType>(i));