¡@

Home 

java Programming Glossary: timeleft

Investigation of optimal sleep time calculation in game loop

http://stackoverflow.com/questions/5274619/investigation-of-optimal-sleep-time-calculation-in-game-loop

9ms . private long timeBefore 0L private long timeSleepEnd timeLeft The estimated game update rate. private double timeUpdateRate.. if timeBefore 0L Calculate optimal game loop sleep time. timeLeft timeLoop System.nanoTime timeBefore If all necessary calculations.. by the sleepTimeBuffer. Max update rate was reached. if timeLeft 0 isUpdateRateLimited Determine when to stop sleeping. timeSleepEnd..