org.xith3d.loop
Class SmoothFPSLimiter

java.lang.Object
  extended by org.xith3d.loop.SmoothFPSLimiter
All Implemented Interfaces:
FPSLimiter

public class SmoothFPSLimiter
extends java.lang.Object
implements FPSLimiter

The SmoothFPSLimiter is an implementation of FPSLimiter, that guarantees the movement to be smoothed at the cost of 100% (virtual) CPU load.


Constructor Summary
SmoothFPSLimiter()
           
 
Method Summary
static SmoothFPSLimiter getInstance()
           
 long limitFPS(long frameIdx, long frameTime, long minFrameTime, org.jagatoo.util.timing.TimerInterface timer)
          Limits the FPS to a known value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmoothFPSLimiter

public SmoothFPSLimiter()
Method Detail

getInstance

public static final SmoothFPSLimiter getInstance()

limitFPS

public long limitFPS(long frameIdx,
                     long frameTime,
                     long minFrameTime,
                     org.jagatoo.util.timing.TimerInterface timer)
Limits the FPS to a known value.

Specified by:
limitFPS in interface FPSLimiter
Parameters:
frameIdx - the index of the current frame (zero-based)
frameTime - the time needed to render the current frame (in nano-seconds)
minFrameTime - the minimal frame-time (in nano-seconds) If each frame would take exactly minFrameTime, the desired FPS would be exactly matched.
timer - a TimerInterface to retrieve the current time
Returns:
the wait-time, that is virtually added to the frame-time.