Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 39 lines (29 sloc) 0.649 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#!/usr/bin/env perl

use SDL;
use SDL::Timer;
use SDL::Event;

die "usage: $0\n" if in( $ARGV[0], qw/ -? -h --help/ );

SDL::Init(SDL_INIT_TIMER);

print STDERR "Waiting 4 seconds\n";
SDL::Delay(4000);

$a = SDL::Timer->new(
sub {
my $timer = shift;
print STDERR "Timer A: $$timer{-times} runs\n";
},
-delay => 1000,
-times => 10
);

$b = SDL::Timer->new(
sub { print STDERR "Timer B: ", ++$i, "\n" },
-delay => 3000
);

$c = SDL::Timer->new(
sub { print STDERR "Timer C: restarting Timer A\n"; $a->run( 1000, 10 ) },
-delay => 19000,
-times => 1
);

SDL::Delay(30000);

print STDERR "Cleaning up...\n";
SDL::Delay(300);

SDL::Quit();
Something went wrong with that request. Please try again.