org.xith3d.loop
Class LimitedUpdater

java.lang.Object
  extended by org.xith3d.loop.LimitedUpdater
All Implemented Interfaces:
Updatable, Updater

public class LimitedUpdater
extends java.lang.Object
implements Updater, Updatable

This Updater implementation manages cares about the frameTime posted to the Updatables not being greater than a specific value. If a frame took more than this value, the Updatables are invoked in several small steps of (up to) maxFrameTime each.


Constructor Summary
LimitedUpdater(long maxFrameTime)
           
LimitedUpdater(long maxFrameTime, boolean gameTimeStepped)
           
 
Method Summary
 void addUpdatable(Updatable updatable)
          Adds a new Updatable instance to the list, that is worked each frame.
 long getMaxFrameTime()
           
 boolean isGameTimeStepped()
           
 void removeUpdatable(Updatable updatable)
          Removes an Updatable instance from the list, that is worked each frame.
 void setGameTimeStepped(boolean stepped)
          Sets, if the game-time is stepped with the maximum frame-time.
 void setMaxFrameTime(long maxFrameTime)
          Sets the time-interval, one frame is allowed to take at maximum.
 void update(long gameTime, long frameTime, UpdatingThread.TimingMode timingMode)
          Updates this Updatable object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LimitedUpdater

public LimitedUpdater(long maxFrameTime,
                      boolean gameTimeStepped)

LimitedUpdater

public LimitedUpdater(long maxFrameTime)
Method Detail

addUpdatable

public void addUpdatable(Updatable updatable)
Adds a new Updatable instance to the list, that is worked each frame. This is like adding a ScheduledOperation, that is infinitely alive and persistent.

Specified by:
addUpdatable in interface Updater

removeUpdatable

public void removeUpdatable(Updatable updatable)
Removes an Updatable instance from the list, that is worked each frame.

Specified by:
removeUpdatable in interface Updater

setMaxFrameTime

public void setMaxFrameTime(long maxFrameTime)
Sets the time-interval, one frame is allowed to take at maximum. If a frame took more than this value, the Updatables are invoked in several small steps of (up to) maxFrameTime each.

Parameters:
maxFrameTime -

getMaxFrameTime

public final long getMaxFrameTime()
Returns:
the time-interval, one frame is allowed to take at maximum. If a frame took more than this value, the Updatables are invoked in several small steps of (up to) maxFrameTime each.

setGameTimeStepped

public void setGameTimeStepped(boolean stepped)
Sets, if the game-time is stepped with the maximum frame-time.

Parameters:
stepped -

isGameTimeStepped

public final boolean isGameTimeStepped()
Returns:
if the game-time is stepped with the maximum frame-time.

update

public void update(long gameTime,
                   long frameTime,
                   UpdatingThread.TimingMode timingMode)
Updates this Updatable object.

Specified by:
update in interface Updatable
Parameters:
gameTime - the gameTime in Milliseconds
frameTime - the frameTime in Milliseconds (needed time for the last frame)
timingMode - the TimingMode to use for frameTime.