title: Game Development: How to limit FPS?
body: <p>I'm writing a game, and I saw the FPS algorithm doesn't work correctly (when he have to calculate more, he sleeps longer...) So, the question is very simple: how to calculate the sleeptime for having correct FPS?</p>
  
  <p>I know how long it took to update the game one frame in microseconds and of course the FPS I want to reach.</p>
  
  <p>I'm searching crazy for a simple example, but I can't find one....</p>
  
  <p>The code may be in Java, C++ or pseudo....</p>