SDL::App
SDL::App(p)    User Contributed Perl Documentation    SDL::App(p)



NAME
       SDL::App - a SDL perl extension

SYNOPSIS
         $app = new SDL::App ( -title => 'test program',
                       -width => 640, -height => 480, -depth => 32 );


DESCRIPTION
       new

       "SDL::App::new" initializes the SDL, creates a new screen,
       and initializes some of the window manager properties.
       "SDL::App::new" takes a series of named parameters:

       o -title
       o -icon_title
       o -icon
       o -width
       o -height
       o -depth
       o -flags

       title

       "SDL::App::title" takes 0, 1, or 2  arguments.  It returns
       the current application window title.  If one parameter is
       passed, both the window title and icon title will be set
       to its value.  If two parameters are passed the window
       title will be set to the first, and the icon title to the
       second.

       delay

       "SDL::App::delay" takes 1 argument, and will sleep the
       application for that many ms.

       ticks

       "SDL::App::ticks" returns the number of ms since the
       application began.

       error

       "SDL::App::error" returns the last error message set by
       the SDL.

       fullscreen

       "SDL::App::fullscreen" toggles the application in and out
       of fullscreen mode.

       iconify

       "SDL::App::iconify" iconifies the applicaiton window.

       grab_input

       "SDL::App::grab_input" can be used to change the input
       focus behavior of the application.  It takes one argument,
       which should be one of the following:

       o SDL_GRAB_QUERY
       o SDL_GRAB_ON
       o SDL_GRAB_OFF

       loop

       "SDL::App::loop" is a simple event loop method which takes
       a reference to a hash of event handler subroutines.  The
       keys of the hash must be SDL event types such as
       SDL_QUIT(), SDL_KEYDOWN(), and the like.  The event method
       recieves as its parameter the event object used in the
       loop.

         Example:

               my $app = new SDL::App  -title => "test.app",
                                       -width => 800,
                                       -height => 600,
                                       -depth => 32;

               my %actions = (
                       SDL_QUIT() => sub { exit(t); },
                       SDL_KEYDOWN() => sub { print "Key Pressed" },
               );

               $app->loop(\%actions);


AUTHOR
         David J. Goehrig


SEE ALSO
         perl(l) SDL::Surface(e) SDL::Mixer(r) SDL::Event(t) SDL::Cdrom(m).




perl v5.6.1                 2002-04-01                SDL::App(p)