Commit 799d2944 authored by Georg Schaefer's avatar Georg Schaefer
Browse files

use SDL_GetTicks instead of chrono

parent 8ddf70c5
#include <chrono>
#include <SDL.h>
#include <asset/asset.hpp>
......@@ -45,9 +43,8 @@ namespace gdw {
void engine::run() {
auto event = SDL_Event();
auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
auto last_time = 0.f;
auto current_time = std::chrono::duration_cast<std::chrono::duration<float>>(duration).count();
auto current_time = static_cast<float>(SDL_GetTicks()) / 1000.f;
auto delta_time = 0.f;
while (!quit_) {
......@@ -56,9 +53,8 @@ namespace gdw {
quit_ = true;
}
}
duration = std::chrono::high_resolution_clock::now().time_since_epoch();
last_time = current_time;
current_time = std::chrono::duration_cast<std::chrono::duration<float>>(duration).count();
current_time = static_cast<float>(SDL_GetTicks()) / 1000.f;
delta_time = current_time - last_time;
update(delta_time);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment