From 5657b38ef029902cb3ea09a6afd4a00db1d60bbc Mon Sep 17 00:00:00 2001 From: Per Inge Mathisen Date: Mon, 7 Jan 2008 20:48:29 +0000 Subject: [PATCH] Hopefully fix bug that would lock fps setting to defaults. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3403 4a71c877-e1ca-e34f-864e-861f7616d084 --- lib/framework/frame.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/framework/frame.c b/lib/framework/frame.c index 55b60a3f6..de257d88f 100644 --- a/lib/framework/frame.c +++ b/lib/framework/frame.c @@ -86,9 +86,16 @@ static Uint64 lastFrames = 0; static Uint32 curTicks = 0; // Number of ticks since execution started static Uint32 lastTicks = 0; static FPSmanager wzFPSmanager; +static BOOL initFPSmanager = FALSE; void setFramerateLimit(int fpsLimit) { + if (!initFPSmanager) + { + /* Initialize framerate handler */ + SDL_initFramerate(&wzFPSmanager); + initFPSmanager = TRUE; + } SDL_setFramerate(&wzFPSmanager, fpsLimit); } @@ -239,17 +246,14 @@ BOOL frameInitialise( /* initialise all cursors */ initCursors(); - /* Initialise the Direct Draw Buffers */ if (!screenInitialise(width, height, bitDepth, fullScreen)) { return FALSE; } - /* Initialize framerate handler */ - SDL_initFramerate( &wzFPSmanager ); - /* Initialise the input system */ inputInitialise(); + /* Initialise the frame rate stuff */ InitFrameStuff();