NAME

SDL::App::FPS::Timer - a timer class for SDL::App::FPS

SYNOPSIS

my $timer = SDL::App::FPS::Timer->new(
	$time_to_first_shot,
	$count,
	$delay_between_shots,
	$now,
	$callback,
	$arguments_to_callback
);

DESCRIPTION

This package provides a timer class. It is used by SDL::App::FPS and you need not to use it directly.

CALLBACK

Once the timer has expired, the callback code (CODE ref) is called with the following parameters:

&{$callback}($self,$id,@arguments);

$self is the timer itself, $id it's id, and the additional arguments are just the $app that you ar running it (e.g. the object of type SDL::App::FPS).

METHODS

new()

Creates a new timer.

next_shot()
$timer->next_shot();

Returns the absolute time when the timer will fire the next time.

due()

Check whether the time is due or not. If is ise due (or overdue), it will fire.

id()

Returns the timers unique id.

fired()

Returns whether the timer fired or not. Use only after calling due().

count()

Returns the number of 'shots' left. Negative value means the timer will fire infinitely often.

BUGS

due() does ignore when the timer should have fire multiple times between it was started and the time it is checked. E.g. when then timer is due in 100 ms, and should fire 3 times, and then is checked the first time after 1000 ms, it should imidiately 3 times, each time having a different overdue time.

Currently it fires only once.

AUTHORS

(c) Tels <http://bloodgate.com/>

SEE ALSO

SDL:App::FPS, SDL::App and SDL.