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));
|
||||
|
||||
@ -28,7 +28,7 @@ public:
|
||||
void tickGravity(double frameMs); // advance gravity accumulator & drop
|
||||
void softDropBoost(double frameMs); // accelerate fall while held
|
||||
void hardDrop(); // instant drop & lock
|
||||
void setSoftDropping(bool on) { softDropping = on; } // mark if player holds Down
|
||||
void setSoftDropping(bool on); // mark if player holds Down
|
||||
void move(int dx); // horizontal move
|
||||
void rotate(int dir); // +1 cw, -1 ccw (simple wall-kick)
|
||||
void holdCurrent(); // swap with hold (once per spawn)
|
||||
|
||||
Reference in New Issue
Block a user