|
|
@@ -67,7 +67,7 @@ static struct nk_sdl {
|
|
|
struct nk_sdl_device ogl;
|
|
|
struct nk_context ctx;
|
|
|
struct nk_font_atlas atlas;
|
|
|
- float delta_time_seconds_last;
|
|
|
+ Uint64 time_of_last_frame;
|
|
|
} sdl;
|
|
|
|
|
|
#ifdef __APPLE__
|
|
|
@@ -199,9 +199,9 @@ nk_sdl_render(enum nk_anti_aliasing AA, int max_vertex_buffer, int max_element_b
|
|
|
{ -1.0f, 1.0f, 0.0f, 1.0f },
|
|
|
};
|
|
|
|
|
|
- float now = ((float)SDL_GetTicks64()) / 1000;
|
|
|
- sdl.ctx.delta_time_seconds = now - sdl.delta_time_seconds_last;
|
|
|
- sdl.delta_time_seconds_last = now;
|
|
|
+ Uint64 now = SDL_GetTicks64();
|
|
|
+ sdl.ctx.delta_time_seconds = (float)(now - sdl.time_of_last_frame) / 1000;
|
|
|
+ sdl.time_of_last_frame = now;
|
|
|
|
|
|
SDL_GetWindowSize(sdl.win, &width, &height);
|
|
|
SDL_GL_GetDrawableSize(sdl.win, &display_width, &display_height);
|
|
|
@@ -326,7 +326,7 @@ nk_sdl_init(SDL_Window *win)
|
|
|
sdl.ctx.clip.paste = nk_sdl_clipboard_paste;
|
|
|
sdl.ctx.clip.userdata = nk_handle_ptr(0);
|
|
|
nk_sdl_device_create();
|
|
|
- sdl.time_of_last_frame = ((float)SDL_GetTicks64()) / 1000;
|
|
|
+ sdl.time_of_last_frame = SDL_GetTicks64();
|
|
|
return &sdl.ctx;
|
|
|
}
|
|
|
|