/* ────────────────────────────────────────────────────────────────
   GameClock — High-precision game timing
──────────────────────────────────────────────────────────────── */
class GameClock {
    constructor(fixedFps = 60) {
        this._startTime = 0;
        this._elapsed = 0;
        this._delta = 0;
        this._frame = 0;
        this._timeScale = 1;
        this._paused = false;
        this._fixedDelta = 1 / fixedFps;
        this._startTime = performance.now() / 1000;
    }
    /* ── Getters ────────────────────────────────────────────────── */
    /** Total elapsed time in seconds (affected by timeScale) */
    get elapsed() {
        return this._elapsed;
    }
    /** Delta time for current frame in seconds */
    get delta() {
        return this._delta;
    }
    /** Fixed timestep for physics */
    get fixedDelta() {
        return this._fixedDelta;
    }
    /** Current frame number */
    get frame() {
        return this._frame;
    }
    /** Time scale multiplier (0 = frozen, 1 = normal, 2 = 2x) */
    get timeScale() {
        return this._timeScale;
    }
    set timeScale(value) {
        this._timeScale = Math.max(0, value);
    }
    get paused() {
        return this._paused;
    }
    /** Real time since start in seconds (unaffected by timeScale) */
    get realTime() {
        return performance.now() / 1000 - this._startTime;
    }
    /* ── Methods ────────────────────────────────────────────────── */
    /** Called each frame with raw delta */
    tick(rawDelta) {
        this._delta = this._paused ? 0 : rawDelta * this._timeScale;
        this._elapsed += this._delta;
        this._frame++;
    }
    pause() {
        this._paused = true;
    }
    resume() {
        this._paused = false;
    }
    reset() {
        this._elapsed = 0;
        this._delta = 0;
        this._frame = 0;
        this._startTime = performance.now() / 1000;
    }
}

export { GameClock };
//# sourceMappingURL=GameClock.js.map
