fixed timer functions
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <SDL3/SDL.h>
|
||||
#include "../../core/GravityManager.h"
|
||||
|
||||
enum PieceType { I, O, T, S, Z, J, L, PIECE_COUNT };
|
||||
@ -40,13 +41,14 @@ public:
|
||||
bool canHoldPiece() const { return canHold; }
|
||||
bool isGameOver() const { return gameOver; }
|
||||
bool isPaused() const { return paused; }
|
||||
void setPaused(bool p) { paused = p; }
|
||||
void setPaused(bool p);
|
||||
int score() const { return _score; }
|
||||
int lines() const { return _lines; }
|
||||
int level() const { return _level; }
|
||||
int startLevelBase() const { return startLevel; }
|
||||
double elapsed() const { return _elapsedSec; }
|
||||
void addElapsed(double frameMs) { if (!paused) _elapsedSec += frameMs/1000.0; }
|
||||
double elapsed() const; // Now calculated from start time
|
||||
void updateElapsedTime(); // Update elapsed time from system clock
|
||||
bool isSoftDropping() const { return softDropping; }
|
||||
|
||||
// Block statistics
|
||||
const std::array<int, PIECE_COUNT>& getBlockCounts() const { return blockCounts; }
|
||||
@ -69,6 +71,7 @@ public:
|
||||
void setGravityGlobalMultiplier(double m) { gravityGlobalMultiplier = m; }
|
||||
double getGravityGlobalMultiplier() const;
|
||||
double getGravityMs() const;
|
||||
double getFallAccumulator() const { return fallAcc; } // Debug: time accumulated toward next drop
|
||||
void setLevelGravityMultiplier(int level, double m);
|
||||
|
||||
private:
|
||||
@ -85,7 +88,9 @@ private:
|
||||
int _level{1};
|
||||
double gravityMs{800.0};
|
||||
double fallAcc{0.0};
|
||||
double _elapsedSec{0.0};
|
||||
Uint64 _startTime{0}; // Performance counter at game start
|
||||
Uint64 _pausedTime{0}; // Time spent paused (in performance counter ticks)
|
||||
Uint64 _lastPauseStart{0}; // When the current pause started
|
||||
bool gameOver{false};
|
||||
int startLevel{0};
|
||||
bool softDropping{false}; // true while player holds Down key
|
||||
|
||||
Reference in New Issue
Block a user