9 my $menu = new SDL::Surface -name => 'data/menu.png';
11 my $app = new SDL::App -w => $menu->width(), -h => $menu->height(), -resizeable => 1;
13 my $hilight = new SDL::Surface -name => 'data/highlight.png';
16 'start' => [ 115, 30, 160, 40 ],
17 'help' => [ 120, 100, 120, 40 ],
18 'giveup' => [ 120, 230, 120, 40 ],
19 'spawnserver' => [ 115, 170, 165, 40 ],
20 'credits' => [ 115, 285, 160, 40 ],
25 my ($a,$dx,$dy,$no,$hi,%m) = @_;
27 my ($x,$y,$w,$h) = @{$m{$_}};
28 next unless $dx >= $x && $dx <= $x+$w
29 && $dy >= $y && $dy <= $y+$h;
31 my $rect = new SDL::Rect -w => $w, -h => $h,
33 $hi->blit($rect,$a,$rect);
38 $no->blit(NULL,$a,NULL) if $needblit;
45 This should print a help message
52 print STDERR <<CREDITS;
61 Spawinging new server...
69 This should start the game
76 print STDERR <<GIVEUP;
85 SDL_MOUSEMOTION() => sub {
94 SDL_MOUSEBUTTONUP() => sub {
96 my $routine = drawMenu($app,
102 &{$routine} if ($routine);
104 SDL_QUIT() => sub { exit(0); },
105 SDL_KEYDOWN() => sub {
107 exit(0) if ($e->key_sym() == SDLK_ESCAPE);
111 $menu->blit(NULL,$app,NULL);
113 $app->loop(\%events);