Here's what I do: Declare 2 global variables: FPS, and MS Find a part of code that gets ran every frame, preferably your main loop. Place this code: FPS=(FPS*11+1000/(MILLISEC-MS))/12 MS=MILLISEC ?FPS You'll notice the *11 and /12 or /(11+1), that will stabilize the number so it moves smoothly, and 11 has been tested as a good smoothness ratio.