From a1c0e86026e4e056c221a677216ee06095260f1e Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Sat, 13 Jun 2020 20:07:01 -0400 Subject: [PATCH] Code cleanup, found that rendering of openGL graphics are limiting the max frame speed to 60 hz. Have not solution for it yet. --- src/drivers/sdl/sdl-throttle.cpp | 10 +++++++--- src/drivers/sdl/sdl.cpp | 9 ++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/drivers/sdl/sdl-throttle.cpp b/src/drivers/sdl/sdl-throttle.cpp index 6832f954..498d4fe7 100644 --- a/src/drivers/sdl/sdl-throttle.cpp +++ b/src/drivers/sdl/sdl-throttle.cpp @@ -75,9 +75,13 @@ SpeedThrottle() else InFrame = 0; - /*fprintf(stderr, "attempting to sleep %Ld ms, frame complete=%s\n", - time_left, InFrame?"no":"yes");*/ - SDL_Delay(time_left); + //fprintf(stderr, "attempting to sleep %Ld ms, frame complete=%s\n", + // time_left, InFrame?"no":"yes"); + + if ( time_left > 0 ) + { + SDL_Delay(time_left); + } if(!InFrame) { diff --git a/src/drivers/sdl/sdl.cpp b/src/drivers/sdl/sdl.cpp index 3d10af15..fb421832 100644 --- a/src/drivers/sdl/sdl.cpp +++ b/src/drivers/sdl/sdl.cpp @@ -911,11 +911,18 @@ int main(int argc, char *argv[]) while(1) { if(GameInfo) + { DoFun(frameskip, periodic_saves); + } else + { SDL_Delay(1); + } + while(gtk_events_pending()) - gtk_main_iteration_do(FALSE); + { + gtk_main_iteration_do(FALSE); + } } } else