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