code_junkie

Fixed vs. variable frame rates in games: what is best, and when?

Nov 10th, 2011
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. const float STEP = 60.f / 1000.f;
  2. float accumulator = 0.f;
  3.  
  4. void Update(float delta)
  5. {
  6. accumulator += delta;
  7.  
  8. while(accumulator > STEP)
  9. {
  10. Simulate(STEP);
  11. accumulator -= STEP;
  12. }
  13. }
Add Comment
Please, Sign In to add comment