migrat Logo a time based

This commit is contained in:
2025-10-26 18:01:02 +01:00
parent 342177a751
commit 0388adfed8
7 changed files with 259 additions and 171 deletions

View File

@@ -0,0 +1,27 @@
#pragma once
#include <SDL3/SDL.h>
#include <algorithm>
class DeltaTimer {
public:
DeltaTimer() noexcept;
// Calcula delta en segundos y actualiza el contador interno
float tick() noexcept;
// Devuelve el delta estimado desde el último tick sin actualizar el contador
float peek() const noexcept;
// Reinicia el contador al valor actual o al valor pasado (en performance counter ticks)
void reset(Uint64 counter = 0) noexcept;
// Escala el tiempo retornado por tick/peek, por defecto 1.0f
void setTimeScale(float scale) noexcept;
float getTimeScale() const noexcept;
private:
Uint64 last_counter_;
double perf_freq_;
float time_scale_;
};