X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2FSDL-App.html-inc;fp=pages%2FSDL-App.html-inc;h=10356be8a5cbbc92f87988790e51658edf999703;hb=f373167ec31ba16ae0770ba461f9de43f41a7ac1;hp=2e3ac929d3335415b3caa34c83e82417c0b002e5;hpb=56d4907c407e8564b4a8a9d09e252573131fad3e;p=sdlgit%2FSDL-Site.git diff --git a/pages/SDL-App.html-inc b/pages/SDL-App.html-inc index 2e3ac92..10356be 100644 --- a/pages/SDL-App.html-inc +++ b/pages/SDL-App.html-inc @@ -39,31 +39,32 @@
use SDL; - use SDL::Event; - use SDL::App; - - my $app = new SDL::App ( - -title => 'Application Title', - -width => 640, - -height => 480, - -depth => 32 ); +use SDL; + use SDL::App; + use SDL::Event; + use SDL::Events; + + my $app = SDL::App->new( + -title => 'Application Title', + -width => 640, + -height => 480, + -depth => 32 + );This is the manual way of doing things
-my $event = new SDL::Event; # create a new event +my $event = SDL::Event->new; # create a new event - $event->pump(); - $event->poll(); + SDL::Events::pump_events(); - while ($event->wait()) { - my $type = $event->type(); # get event type - print $type; - exit if $type == SDL_QUIT; - } -An alternative to the manual Event processing is the L<SDL::App::loop> . + while ( SDL::Events::poll_event($event) ) { + my $type = $event->type(); # get event type + print $type; + exit if $type == SDL_QUIT; + }+An alternative to the manual Event processing is the SDL::App::loop .
Example: - - my $app = new SDL::App -title => "test.app", - -width => 800, - -height => 600, - -depth => 32; - - my %actions = ( - SDL_QUIT() => sub { exit(0); }, - SDL_KEYDOWN() => sub { print "Key Pressed" }, - ); - - $app->loop(\%actions); +Example:
+my $app = SDL::App->new( + -title => "test.app", + -width => 800, + -height => 600, + -depth => 32 + ); + + my %actions = ( + SDL_QUIT() => sub { exit(0); }, + SDL_KEYDOWN() => sub { print "Key Pressed" }, + ); + + $app->loop( \%actions );