5 SDL::App - a SDL perl extension
13 my $app = new SDL::App (
14 -title => 'Application Title',
19 This is the manual way of doing things
21 my $event = new SDL::Event; # create a new event
26 while ($event->wait()) {
27 my $type = $event->type(); # get event type
29 exit if $type == SDL_QUIT;
31 An alternative to the manual Event processing is the L<SDL::App::loop> .
35 L<SDL::App> controls the root window of the of your SDL based application.
36 It extends the L<SDL::Surface> class, and provides an interface to the window
37 manager oriented functions.
43 C<SDL::App::new> initializes the SDL, creates a new screen,
44 and initializes some of the window manager properties.
45 C<SDL::App::new> takes a series of named parameters:
85 C<SDL::App::title> takes 0, 1, or 2 arguments. It returns the current
86 application window title. If one parameter is passed, both the window
87 title and icon title will be set to its value. If two parameters are
88 passed the window title will be set to the first, and the icon title
93 C<SDL::App::delay> takes 1 argument, and will sleep the application for
98 C<SDL::App::ticks> returns the number of ms since the application began.
102 C<SDL::App::error> returns the last error message set by the SDL.
106 C<SDL::App::resize> takes a new height and width of the application
107 if the application was originally created with the -resizable option.
111 C<SDL::App::fullscreen> toggles the application in and out of fullscreen mode.
115 C<SDL::App::iconify> iconifies the applicaiton window.
119 C<SDL::App::grab_input> can be used to change the input focus behavior of
120 the application. It takes one argument, which should be one of the following:
137 C<SDL::App::loop> is a simple event loop method which takes a reference to a hash
138 of event handler subroutines. The keys of the hash must be SDL event types such
139 as SDL_QUIT(), SDL_KEYDOWN(), and the like. The event method recieves as its parameter
140 the event object used in the loop.
144 my $app = new SDL::App -title => "test.app",
150 SDL_QUIT() => sub { exit(0); },
151 SDL_KEYDOWN() => sub { print "Key Pressed" },
154 $app->loop(\%actions);
158 C<SDL::App::sync> encapsulates the various methods of syncronizing the screen with the
159 current video buffer. C<SDL::App::sync> will do a fullscreen update, using the double buffer
160 or OpenGL buffer if applicable. This is prefered to calling flip on the application window.
162 =head2 attribute ( attr, [value] )
164 C<SDL::App::attribute> allows one to set and get GL attributes. By passing a value
165 in addition to the attribute selector, the value will be set. C<SDL:::App::attribute>
166 always returns the current value of the given attribute, or croaks on failure.
175 L<perl> L<SDL::Surface> L<SDL::Event> L<SDL::OpenGL>