   SDL Framerate
  Hi everyone. I feel stupid asking this because I know Lazy foo has a tutorial on this (I can't access his site from work for some reason). How do you control the framerate of a program. Currently my applications are running wildly out of control and eating up way too much of the CPU. Thanks!   
  I believe that SDL_gfx has a built-in mechanism to do frame limiting; you can write one yourself as well. Basically you want to do something like this:while(gameIsRunning) {  startTime = getTimeInMilliseconds(); runOneFrame(); endTime = getTimeInMilliseconds(); sleepInMilliseconds(endTime - startTime / FramesPerSecond * 1000);}Sleeping is the key thing here; when your program sleeps, it cedes control to the OS, which can then run other programs. This will keep your program from eating all of the CPU.   ;  You can put SDL_Delay(0) at the end of your main loop, which should allow the OS time to manage whatever it wants without throttling. This is particularly useful on laptops and computers featuring CPU-controlled fans.   ;  The SDL_gfx library features a framerate manager which I really recommend you take a look at.   ;  Thanks for your responces. I was able to get the frame rate controled like Derakon suggested. It has halved my CPU usage which, is awsome. I just need to do a little more optimization and I should be all set! Thanks again.   