smooth scroll added
This commit is contained in:
@ -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));
|
||||
|
||||
Reference in New Issue
Block a user