Fix loop to be more accuratly timed, and added custom ruby libs inclusion setup

This commit is contained in:
2026-05-20 17:30:38 +01:00
parent 1a337608f3
commit 7d48b226ab
11 changed files with 1117 additions and 27 deletions
+1
View File
@@ -1,6 +1,7 @@
#include "binding/definitions.h"
int main(int argc, char *argv[]) {
Ruby::load_mgems();
definitions::setup();
char *startup_script = nullptr;
+5 -2
View File
@@ -451,14 +451,17 @@ const char *Window::paste() {
}
uint64_t Window::get_time() {
return SDL_GetTicks();
return SDL_GetTicksNS();
}
uint64_t Window::delta_time() {
static uint64_t last_time = 0;
uint64_t current_time = SDL_GetTicks();
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;
}