smooth scroll left / right

This commit is contained in:
2025-11-30 12:29:09 +01:00
parent fc828dbdbc
commit 588f870b26
5 changed files with 45 additions and 9 deletions

View File

@ -64,7 +64,9 @@ void Game::reset(int startLevel_) {
_pausedTime = 0;
_lastPauseStart = 0;
hold = Piece{}; hold.type = PIECE_COUNT; canHold=true;
refillBag(); spawn();
refillBag();
pieceSequence = 0;
spawn();
}
double Game::elapsed() const {
@ -166,6 +168,7 @@ void Game::spawn() {
PieceType nextType = bag.back();
int nextSpawnY = (nextType == I) ? -2 : -1;
nextPiece = Piece{ nextType, 0, 3, nextSpawnY };
++pieceSequence;
}
bool Game::cellFilled(const Piece& p, int cx, int cy) {

View File

@ -80,6 +80,7 @@ public:
double hardDropShakeStrength() const;
const std::vector<SDL_Point>& getHardDropCells() const { return hardDropCells; }
uint32_t getHardDropFxId() const { return hardDropFxId; }
uint64_t getCurrentPieceSequence() const { return pieceSequence; }
private:
std::array<int, COLS*ROWS> board{}; // 0 empty else color index
@ -121,6 +122,7 @@ private:
static constexpr double HARD_DROP_SHAKE_DURATION_MS = 320.0;
std::vector<SDL_Point> hardDropCells;
uint32_t hardDropFxId{0};
uint64_t pieceSequence{0};
// Internal helpers ----------------------------------------------------
void refillBag();