Guest User

Untitled

a guest
Nov 6th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. private static float getTime()
  2. {
  3. return (Sys.getTime() * 1000) / Sys.getTimerResolution();
  4. }
  5.  
  6. public static float getDeltaTime()
  7. {
  8. return delta;
  9. }
  10.  
  11. private void displayDelta()
  12. {
  13. if (getTime() - lastFps > 1000)
  14. {
  15. Display.setTitle("Dino Pizza Attack! FPS: " + fps);
  16. fps = 0;
  17. lastFps += 1000;
  18. }
  19. fps++;
  20. }
  21.  
  22. // Straight code which calculates delta
  23. // This code goes inside of my main update() loop
  24.  
  25. time = getTime();
  26. delta = time - lastFrame;
  27. lastFrame = time;
Advertisement
Add Comment
Please, Sign In to add comment