time-based: nou DeltaTime + migrada escena Logo (constants en segons, fora counters)

This commit is contained in:
2026-05-18 21:57:31 +02:00
parent 081a7e02c7
commit f1a6636222
4 changed files with 70 additions and 33 deletions
+22
View File
@@ -0,0 +1,22 @@
#include "core/system/delta_time.hpp"
#include <SDL3/SDL.h>
namespace DeltaTime {
namespace {
Uint64 last_time_ms = 0;
}
void reset() {
last_time_ms = SDL_GetTicks();
}
auto tick() -> float {
const Uint64 NOW_MS = SDL_GetTicks();
const float DELTA_S = static_cast<float>(NOW_MS - last_time_ms) / 1000.0F;
last_time_ms = NOW_MS;
return DELTA_S;
}
} // namespace DeltaTime