Package nl.colorize.multimedialib.scene
Class Timer
java.lang.Object
nl.colorize.multimedialib.scene.Timer
- All Implemented Interfaces:
Updatable
Utility class for time-based behavior. A timer consists of a position and a
duration. The position is moved during every frame update, until the duration
has been reached.
-
Constructor Summary
ConstructorDescriptionTimer
(float duration) Creates a new timer with the specified duration in seconds. -
Method Summary
Modifier and TypeMethodDescriptionvoid
end()
static Timer
ended
(float duration) Factory method that creates a timer which starts in the ended state, and needs to be reset before it can be used.float
float
getRatio()
float
getTime()
float
static Timer
infinite()
Factory method that creates a timer which will never reach his duration.boolean
static Timer
none()
Factory method that creates a no-op timer with a zero duration.void
reset()
toString()
void
update
(float deltaTime) Updates this object for the current frame.
-
Constructor Details
-
Timer
public Timer(float duration) Creates a new timer with the specified duration in seconds.
-
-
Method Details
-
update
public void update(float deltaTime) Description copied from interface:Updatable
Updates this object for the current frame.deltaTime
indicates the elapsed time since the last frame update, in seconds. -
getTime
public float getTime() -
getTimeRemaining
public float getTimeRemaining() -
getDuration
public float getDuration() -
isCompleted
public boolean isCompleted() -
getRatio
public float getRatio() -
reset
public void reset() -
end
public void end() -
toString
-
none
Factory method that creates a no-op timer with a zero duration. -
infinite
Factory method that creates a timer which will never reach his duration. -
ended
Factory method that creates a timer which starts in the ended state, and needs to be reset before it can be used.
-