A timer is an object that -when the system is dispatching messages- generates an event at regular intervals. Timers are used to implement simulation, blinking (caret) or to wake-up the user under some (time-based) conditions.
The interval of a timer is specified as a real-number. The actual accuracy depends on the timing capabilities offered by the X-implementation on which PCE has been build.
When executing the message, no arguments are forwarded. @receiver
is bound to the timer itself. See timer->execute.
NOTE: When multiple objects are animated at a similar
speed performance will be much better if a single timer is used. The
code below provides a skeleton:
:- pce_global(@stepping, chain).
start_stepping :-
send(new(@stepper,
timer(1, message(@stepper, for_all,
step))),
start).
step(Obj) :-
send(@stepping, append, Obj).
->dispatch).
select().
The interval may be changed when the timer is running. In this case
it will first fire timer<-interval
seconds from the time is was changed.
->execute
for details.->kind.
idle Timer is not running once After timer ->execute’ing once it will stoprepeat Timer will repeat timer ->execute’ing
<-interval.
XPCE processes events while execution is suspended.<-message
with the following arguments:
@receiver The timer itself.
->start
or timer->status
to start the timer.->status:
[repeat].->status:
idle.
@on, timer ->startis equivalent to timer ->status: repeat@off, timer ->stopis equivalent to timer ->status: idle.