PageRenderTime 45ms CodeModel.GetById 39ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/examples/SDLx/app.pl

http://github.com/PerlGameDev/SDL
Perl | 21 lines | 12 code | 9 blank | 0 comment | 2 complexity | 3112191814415a1d5ee1abbdb0186637 MD5 | raw file
 1use SDL::Event;
 2use SDLx::App;
 3
 4my $app = SDLx::App->new(
 5	title  => "Lines",
 6	width  => 640,
 7	height => 480,
 8);
 9
10
11
12sub draw_lines { $app->draw_line( [ 0, 0 ], [ rand( $app->w ), rand( $app->h ) ], 0xFFFFFFFF ); $app->update(); }
13
14sub event_handle { my $e = shift; $_[0]->stop if ( $e->type == SDL_QUIT ); }
15
16$app->add_event_handler( \&event_handle );
17$app->add_show_handler( \&draw_lines );
18
19$app->run();
20
21