Games-Irrlicht
view release on metacpan or search on metacpan
lib/Games/Irrlicht.pm view on Meta::CPAN
immidiately (calls $callback). When the count was 1, and time 0, then
the timer will not be added to the list (it already expired) and undef will be
returned. Otherwise the unique timer id will be returned.
C<@args> can be empty, otherwise the contents of these will be passed to the
callback function as additional parameters.
The timer will fire for the first time at C<$time> ms after the time it was
added, and then wait C<$delay> ms between each shot. if C<$count> is positive,
it gives the number of shots the timer fires, if it is negative, the timer
will fire endlessly until it is removed.
The timers added via add_timer() are coupled to the warped clock.
=item del_timer()
$app->del_timer($timer);
$app->del_timer($timerid);
Delete the given timer (or the one by the given id).
=item timers()
Return count of active timers.
=item hide_mouse_cursor()
$self->hide_mouse_cursor( $vis );
Hides the mouse cursor if C<$vis> is true.
=item add_group()
$group = $app->add_group();
Convienence method to create a new SDL::App::FPS::Group and bind it to this
application. Things (like timers) can be grouped together into groups and
thus can be enabled, deleted etc. in batches more easily.
=item option()
print $app->option('max_fps'),"\n"; # get
$app->option('max_fps',40); # set to 40
Get/sets an option defined by the key (name) and an optional value. The name
space should be prepended with an underscore, like:
print @{ $app->option('console_background_color') },"\n";
=item freeze_time_warp_ramp()
$app->freeze_time_warp_ramp();
Disables any ramping of the time warp that might be in effect.
=item freeze_time()
$app->freeze_time();
Sets the time warp factor to 0, effectively stopping the warped clock. Note
that the real clock still ticks and frames are still drawn, so you can overlay
some menu/animation over a static (froozen in time) background. Of course it
might be more efficient to save the current drawn frame as image and stop
the drawing if the not-changing background altogether.
=item thaw_time()
$app->thaw_time();
Sets the time warp factor back to what it was before L<freeze_time()> was
called. Does nothing when the clock is not frozen.
=item ramp_time_warp
$app->ramp_time_warp($target_factor,$time_to_ramp);
Set a tagret time warp factor and a time it will take to get to this factor.
The time warp (see L<time_warp()>) will then be gradually adjusted to the
target factor. C<$time_to_ramp> is in ms (aka 1000 == one second).
It is sometimes a good idea to read out the current time warp and ramp it to
a specific factor, like so:
$time_warp = $app->time_warp();
$app->ramp_time_warp($time_warp * 2, 1000);
But you need to restrict this somehow, otherwise the clock might be speed up
or slowed down to insanely high or low speeds. So sometimes it is just better
to do this:
sub enable_slow_motion
{
# no matter how fast clock now is, slow it down to a fixed value
$app->ramp_time_warp(0.5, 1000);
}
When ramp_time_warp() is called without arguments, and ramping is in effect,
it returns a list consisting of:
target factor # to where we ramp
time to ramp # how long it takes (ticks)
current time warp # where are currently
start time warp # from where we ramp (factor)
start time warp time # from where we ramp (real time ticks)
When no ramping is in effect, it returns an empty list or undef.
You can disable/stop the time warping by setting a new time warp factor
directly like so:
my $t = $app->time_warp(); $app->time_warp($t);
Or easier:
$app->freeze_time_warp();
=item time_warp
$app->time_warp(2); # fast forward
Get or set the current time warp, e.g. the factor how fast the time passes.
( run in 1.100 second using v1.01-cache-2.11-cpan-364913b4093 )