libgdx API

com.badlogic.gdx.utils
Class Timer

java.lang.Object
  extended by com.badlogic.gdx.utils.Timer

public class Timer
extends java.lang.Object

Executes tasks in the future on the main loop thread.

Author:
Nathan Sweet

Nested Class Summary
static class Timer.Task
          Runnable with a cancel method.
 
Field Summary
static Timer instance
          Timer instance for general application wide usage.
 
Constructor Summary
Timer()
           
 
Method Summary
 void clear()
          Cancels all tasks.
static void post(Timer.Task task)
          Schedules a task on instance.
 void postTask(Timer.Task task)
          Schedules a task to occur once as soon as possible, but not sooner than the start of the next frame.
static void schedule(Timer.Task task, float delaySeconds)
          Schedules a task on instance.
static void schedule(Timer.Task task, float delaySeconds, float intervalSeconds)
          Schedules a task on instance.
static void schedule(Timer.Task task, float delaySeconds, float intervalSeconds, int repeatCount)
          Schedules a task on instance.
 void scheduleTask(Timer.Task task, float delaySeconds)
          Schedules a task to occur once after the specified delay.
 void scheduleTask(Timer.Task task, float delaySeconds, float intervalSeconds)
          Schedules a task to occur once after the specified delay and then repeatedly at the specified interval until cancelled.
 void scheduleTask(Timer.Task task, float delaySeconds, float intervalSeconds, int repeatCount)
          Schedules a task to occur once after the specified delay and then a number of additional times at the specified interval.
 void start()
          Starts the timer if it was stopped.
 void stop()
          Stops the timer, tasks will not be executed and time that passes will not be applied to the task delays.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static final Timer instance
Timer instance for general application wide usage. Static methods on Timer make convenient use of this instance.

Constructor Detail

Timer

public Timer()
Method Detail

postTask

public void postTask(Timer.Task task)
Schedules a task to occur once as soon as possible, but not sooner than the start of the next frame.


scheduleTask

public void scheduleTask(Timer.Task task,
                         float delaySeconds)
Schedules a task to occur once after the specified delay.


scheduleTask

public void scheduleTask(Timer.Task task,
                         float delaySeconds,
                         float intervalSeconds)
Schedules a task to occur once after the specified delay and then repeatedly at the specified interval until cancelled.


scheduleTask

public void scheduleTask(Timer.Task task,
                         float delaySeconds,
                         float intervalSeconds,
                         int repeatCount)
Schedules a task to occur once after the specified delay and then a number of additional times at the specified interval.


stop

public void stop()
Stops the timer, tasks will not be executed and time that passes will not be applied to the task delays.


start

public void start()
Starts the timer if it was stopped.


clear

public void clear()
Cancels all tasks.


post

public static void post(Timer.Task task)
Schedules a task on instance.

See Also:
postTask(Task)

schedule

public static void schedule(Timer.Task task,
                            float delaySeconds)
Schedules a task on instance.

See Also:
scheduleTask(Task, float)

schedule

public static void schedule(Timer.Task task,
                            float delaySeconds,
                            float intervalSeconds)
Schedules a task on instance.

See Also:
scheduleTask(Task, float, float)

schedule

public static void schedule(Timer.Task task,
                            float delaySeconds,
                            float intervalSeconds,
                            int repeatCount)
Schedules a task on instance.

See Also:
scheduleTask(Task, float, float, int)

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)