Improve loop with fps control

This commit is contained in:
2026-05-20 21:47:25 +01:00
parent 6ff16e3db4
commit 2bff3eb93f
5 changed files with 54 additions and 29 deletions
-11
View File
@@ -472,17 +472,6 @@ uint64_t Window::get_time() {
return SDL_GetTicksNS();
}
uint64_t Window::delta_time() {
static uint64_t last_time = 0;
static bool first_call = 1;
uint64_t current_time = SDL_GetTicksNS();
uint64_t delta = current_time - last_time;
last_time = current_time;
if (first_call)
return (first_call = 0);
return delta;
}
void Window::compute_transform() {
float scale_factor_x = real_size.x / virtual_size.x;
float scale_factor_y = real_size.y / virtual_size.y;