[SDL] Setting FPS to 60?
Patricia Curtis
patricia.curtis at gmail.com
Fri Mar 23 10:12:26 PDT 2007
Hi Guys
There appears to be some confusion about what you want to achieve,
from what your saying it sounds like you have a problem with your game being
jerky or going out of time. if this is the case you already have the
solution.
Set a timer for the frame rate you want things to move/animate, in that
timer do the logic/game movements/animations.
(you could have one timer for player movement/animation and another for
background animation running at different speeds)
In your main loop just do the update screen/draw everything so that if its
running on a slow machine everything will move at the same speed, but
the screen will update slowly, if its on a fast machine again it will run at
the same speed and it will be as smooth as silk. a word of warning you can
not poll keys and get events in your timer so do them in your main loop and
set flags or something to pass them to your timer. i tried to get key events
in a timer and i think its because the timer is an event in its self (unless
someone knows different).
OH Try not to the "while(1) think loop" thing i read in one of your usual
posts as it will be burning all your processor time. SDL_Delay i believe
does not simply loop it returns the processor time back to the OS, when i
used one at the end of main loop the processor time the game was
using dropped significantly.
I hope this helps
Trish xx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070324/41b77b13/attachment.html
More information about the SDL
mailing list