Commit | Line | Data |
8fde61e3 |
1 | #!/usr/bin/env perl |
2 | |
3 | use SDL; |
4 | use SDL::Timer; |
24379be6 |
5 | use SDL::Event; |
8fde61e3 |
6 | |
7 | die "usage: $0\n" if in($ARGV[0], qw/ -? -h --help/); |
8 | |
24379be6 |
9 | SDL::Init(SDL_INIT_TIMER); |
8fde61e3 |
10 | |
11 | print STDERR "Waiting 4 seconds\n"; |
12 | SDL::Delay(4000); |
13 | |
14 | $a = new SDL::Timer sub { my $timer = shift; |
15 | print STDERR "Timer A: $$timer{-times} runs\n" }, |
16 | -delay => 1000, |
17 | -times => 10; |
18 | |
19 | $b = new SDL::Timer sub { print STDERR "Timer B: ", ++$i,"\n" }, -delay => 3000; |
20 | |
21 | $c = new SDL::Timer sub { print STDERR "Timer C: restarting Timer A\n"; $a->run(1000,10) }, |
22 | -delay => 19000, |
23 | -times => 1; |
24 | |
25 | SDL::Delay(30000); |
26 | |
27 | print STDERR "Cleaning up...\n"; |
28 | SDL::Delay(300); |
29 | |
30 | SDL::Quit(); |
31 | |