/examples/cookbook/1.pl

http://github.com/PerlGameDev/SDL · Perl · 27 lines · 18 code · 9 blank · 0 comment · 4 complexity · 6b1bc46b7d20d46c96da9688c36590fb MD5 · raw file

  1. use strict;
  2. use warnings;
  3. use SDL;
  4. use SDL::Rect;
  5. use SDL::Event;
  6. use SDL::Video;
  7. use SDL::Events;
  8. use SDL::Surface;
  9. SDL::init(SDL_INIT_VIDEO);
  10. my $display = SDL::Video::set_video_mode( 320, 320, 32, SDL_SWSURFACE );
  11. my $quit = 0;
  12. while ( !$quit ) {
  13. my $event = SDL::Event->new();
  14. SDL::Events::pump_events();
  15. while ( SDL::Events::poll_event($event) ) {
  16. $quit = 1 if ( $event->type == SDL_QUIT );
  17. }
  18. }