public class GTimer extends Object implements GConstantsInternal
void fireBall(GTimer timer){ ... }
ALL_METHOD, CLIP_RUN, COMBI_MODES, DRAW_METHOD, EXCP_IN_HANDLER, grid, I_CL, I_COVERED, I_CR, I_INSIDE, I_MODES, I_NONE, I_TL, I_TR, KEY_METHOD, MERGE_RUNS, MISSING, MOUSE_METHOD, NONEXISTANT, OFF_CONTROL, OVER_CONTROL, pen_1_0, pen_2_0, pen_3_0, pen_4_0, POST_METHOD, PRE_METHOD, PRESS_CONTROL, RUNTIME_ERROR, TINT_FOR_ALPHA
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 G4P by Peter Lager. (C) 2012