public abstract class AnimationTimer
extends java.lang.Object
AnimationTimer
allows to create a timer, that is called in
each frame while it is active.
An extending class has to override the method handle(long)
which
will be called in every frame.
The methods start()
and stop()
allow to start
and stop the timer.Modifier and Type | Class and Description |
---|---|
private class |
AnimationTimer.AnimationTimerReceiver |
Modifier and Type | Field and Description |
---|---|
private java.security.AccessControlContext |
accessCtrlCtx |
private boolean |
active |
private AbstractMasterTimer |
timer |
private AnimationTimer.AnimationTimerReceiver |
timerReceiver |
Constructor and Description |
---|
AnimationTimer()
Creates a new timer.
|
AnimationTimer(AbstractMasterTimer timer) |
Modifier and Type | Method and Description |
---|---|
abstract void |
handle(long now)
This method needs to be overridden by extending classes.
|
void |
start()
Starts the
AnimationTimer . |
void |
stop()
Stops the
AnimationTimer . |
private final AbstractMasterTimer timer
private final AnimationTimer.AnimationTimerReceiver timerReceiver
private boolean active
private java.security.AccessControlContext accessCtrlCtx
public AnimationTimer()
AnimationTimer(AbstractMasterTimer timer)
public abstract void handle(long now)
AnimationTimer
is active.now
- The timestamp of the current frame given in nanoseconds. This
value will be the same for all AnimationTimers
called
during one frame.public void start()
AnimationTimer
. Once it is started, the
handle(long)
method of this AnimationTimer
will be
called in every frame.
The AnimationTimer
can be stopped by calling stop()
.public void stop()
AnimationTimer
. It can be activated again by calling
start()
.