/usr/lib/perl5/pods/SDLx/App.pod is in libsdl-perl 2.540-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | =pod
=head1 NAME
SDLx::App - a SDL perl extension
=head1 CATEGORY
Extension
=head1 SYNOPSIS
use SDL;
use SDLx::App;
use SDL::Event;
use SDL::Events;
my $app = SDLx::App->new(
title => 'Application Title',
width => 640,
height => 480,
depth => 32
);
This is the manual way of doing things
my $event = SDL::Event->new; # create a new event
SDL::Events::pump_events();
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 through the L<SDLx::Controller> module. L<SDLx::App> is a Controller so see the CALLBACKS section below.
=head1 DESCRIPTION
L<SDLx::App> controls the root window of the of your SDL based application.
It extends the L<SDL::Surface> class, and provides an interface to the window
manager oriented functions.
=head1 METHODS
=head2 new
C<SDLx::App::new> initializes the SDL, creates a new screen,
and initializes some of the window manager properties.
C<SDLx::App::new> takes a series of named parameters:
=over 4
=item * title
the window title. Defaults to the file name. Shorter alias: 't'
=item * icon_title
the icon title. Defaults to file name. Shortcut: 'it'
=item * icon
the icon itself. Defaults to none. Shortcut: 'i'
=item * width
Window width, in pixels. Defaults to 800. Shortcut: 'w'
=item * height
Window height, in pixels. Defaults to 600. Shortcut: 'h'
=item * depth
Screen depth. Defaults to 16. Shortcut: 'd'.
=item * flags
Any flags you want to pass to L<SDL::Video> upon initialization. Defaults to SDL_ANYFORMAT. Flags should be I<or'ed> together if you're passing more than one (flags => FOO|BAR). Shortcut: 'f'.
=item * resizable
Set this to a true value to make the window resizable by the user. Default is off.
=item * exit_on_quit
Set this to a true value to make the app exit if a SDL_QUIT event is triggered. Shortcut: 'eoq'.
=back
=head1 METHODS
=head2 title()
=head2 title( $new_title )
=head2 title( $window_title, $icon_title )
C<SDLx::App::title> takes 0, 1, or 2 arguments. If no parameter is given,
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.
=head2 delay( $ms )
C<SDLx::App::delay> takes 1 argument, and will sleep the application for
that many ms.
=head2 ticks
C<SDLx::App::ticks> returns the number of ms since the application began.
=head2 error
C<SDLx::App::error> returns the last error message set by the SDL.
=head2 resize( $width, $height )
C<SDLx::App::resize> takes a new width and height of the application. Only
works if the application was originally created with the resizable option.
=head2 fullscreen
C<SDLx::App::fullscreen> toggles the application in and out of fullscreen mode.
=head2 iconify
C<SDLx::App::iconify> iconifies the application window.
=head2 grab_input( $CONSTANT )
C<SDLx::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:
=over 4
=item * SDL_GRAB_QUERY
=item * SDL_GRAB_ON
=item * SDL_GRAB_OFF
=back
=head2 sync
C<SDLx::App::sync> encapsulates the various methods of synchronizing the screen with the
current video buffer. C<SDLx::App::sync> will do a fullscreen update, using the double buffer
or OpenGL buffer if applicable. This is preferred to calling flip on the application window.
=head2 attribute( $attr )
=head2 attribute( $attr, $value )
C<SDLx::App::attribute> allows one to get and set GL attributes. By passing a value
in addition to the attribute selector, the value will be set. C<SDL:::App::attribute>
always returns the current value of the given attribute, or Carp::confesss on failure.
=head1 CALLBACKS
C<SDLx::App> is a C<SDLx::Controller>. Use the event, show and handlers to run the app.
use SDL;
use SDLx::App;
use SDL::Event; #Where ever the event call back is processed
my $app = SDLx::App->new( width => 200, height => 200);
$app->add_event_handler( sub{ return 0 if $_[0]->type == SDL_QUIT; return 1});
$app->add_show_handler( sub{ $app->update() } );
$app->add_move_handler(
sub{
#calc your physics here
} );
$app->run();
see L<SDLx::Controller> for more details.
=head1 AUTHORS
See L<SDL/AUTHORS>.
=head1 SEE ALSO
L<perl> L<SDL::Surface> L<SDL::Event> L<SDL::OpenGL>
=cut
|