fix: window not rendering
parent
fe9242c9c0
commit
c26f3512c2
|
@ -4,7 +4,7 @@
|
||||||
#include <SDL2/SDL_render.h>
|
#include <SDL2/SDL_render.h>
|
||||||
|
|
||||||
#ifndef PROJECTNAME
|
#ifndef PROJECTNAME
|
||||||
#define PROJECTNAME "application"
|
#define PROJECTNAME "Pass define for PROJECTNAME to change title"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Application::Application() {
|
Application::Application() {
|
||||||
|
@ -42,13 +42,14 @@ void Application::run() {
|
||||||
while(stay_open) {
|
while(stay_open) {
|
||||||
// track frame time
|
// track frame time
|
||||||
std::timespec_get(&this->frame_start_ts, TIME_UTC);
|
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
|
// process events
|
||||||
this->process_events();
|
this->process_events();
|
||||||
// update application implementation
|
// update application implementation
|
||||||
if(this->delta_time > this->target_delta_time) {
|
if(this->delta_time > this->target_delta_time) {
|
||||||
this->tick(this->delta_time);
|
this->tick(this->delta_time);
|
||||||
this->draw(render);
|
this->draw(render);
|
||||||
|
SDL_RenderPresent(this->render);
|
||||||
this->last_frame_start_ts = this->frame_start_ts;
|
this->last_frame_start_ts = this->frame_start_ts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue