public class GTimer extends Object
void fireBall(){ ... }It has no visible GUI representation so will not appear in the GUI.
Constructor and Description |
---|
GTimer(PApplet theApplet,
Object obj,
String methodName,
int delay)
Create the GTimer object with this ctor.
|
Modifier and Type | Method and Description |
---|---|
int |
getInitialDelay()
Get the initial delay time (milliseconds).
|
int |
getInterval()
Get the interval time (milliseconds) between
events.
|
boolean |
isRunning()
Is the timer running?
|
boolean |
isValid()
See if the GTimer object has been created successfully
|
void |
setDelay(int delay)
Sets the initial delay and the interval between events.
|
void |
setInitialDelay(int initDelay)
Set the delay before the first event is triggered
|
void |
setInterval(int interval)
Set the interval between events
|
void |
start()
Start the timer (call the method forever)
|
void |
start(int nrepeats)
Start the timer and call the method for the number of
times indicated by nrepeats
If nrepeats is <=0 then repeat forever
|
void |
stop()
Stop the timer (can be restarted with start() method)
|
public GTimer(PApplet theApplet, Object obj, String methodName, int delay)
theApplet
- a reference to the PApplet object (invariably this)obj
- the object that has the method to be executed (likely to be this)methodName
- the name of the method to be called by the timerdelay
- the initial delay and the time (in millisecs) between function callspublic void start()
public void start(int nrepeats)
nrepeats
- public void stop()
public boolean isRunning()
public void setInterval(int interval)
interval
- delay between events in millisecondspublic void setInitialDelay(int initDelay)
initDelay
- initial delay in millisecondspublic void setDelay(int delay)
setInterval(delay); setInitialDelay(delay);
delay
- initial delay and interval in millisecondspublic int getInterval()
public int getInitialDelay()
public boolean isValid()
Processing library guicomponents by Peter Lager. (C) 2012