fix: window not rendering

main
Sara 2024-11-15 13:31:10 +01:00
parent fe9242c9c0
commit c26f3512c2
1 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@
#include <SDL2/SDL_render.h>
#ifndef PROJECTNAME
#define PROJECTNAME "application"
#define PROJECTNAME "Pass define for PROJECTNAME to change title"
#endif
Application::Application() {
@ -42,13 +42,14 @@ void Application::run() {
while(stay_open) {
// track frame time
std::timespec_get(&this->frame_start_ts, TIME_UTC);
this->delta_time = double(this->last_frame_start_ts.tv_nsec - this->frame_start_ts.tv_nsec) / 1000000000.f;
this->delta_time = double(this->frame_start_ts.tv_nsec - this->last_frame_start_ts.tv_nsec) / 1000000000.f;
// process events
this->process_events();
// update application implementation
if(this->delta_time > this->target_delta_time) {
this->tick(this->delta_time);
this->draw(render);
SDL_RenderPresent(this->render);
this->last_frame_start_ts = this->frame_start_ts;
}
}