Fix loop to be more accuratly timed, and added custom ruby libs inclusion setup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "binding/definitions.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
Ruby::load_mgems();
|
||||
definitions::setup();
|
||||
|
||||
char *startup_script = nullptr;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user