3 <h3 id="TOP">Index</h3>
5 <ul><li><a href="#NAME">NAME</a></li>
6 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
7 <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
8 <li><a href="#METHODS">METHODS</a>
9 <ul><li><a href="#new">new</a></li>
10 <li><a href="#title">title</a></li>
11 <li><a href="#delay">delay</a></li>
12 <li><a href="#ticks">ticks</a></li>
13 <li><a href="#error">error</a></li>
14 <li><a href="#resize">resize</a></li>
15 <li><a href="#fullscreen">fullscreen</a></li>
16 <li><a href="#iconify">iconify</a></li>
17 <li><a href="#grab_input">grab_input</a></li>
18 <li><a href="#loop">loop</a></li>
19 <li><a href="#sync">sync</a></li>
20 <li><a href="#attribute_attr_value">attribute ( attr, [value] )</a></li>
23 <li><a href="#AUTHOR">AUTHOR</a></li>
24 <li><a href="#SEE_ALSO">SEE ALSO</a>
29 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
30 <div id="NAME_CONTENT">
31 <p>SDL::App - a SDL perl extension</p>
34 <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
35 <div id="SYNOPSIS_CONTENT">
40 my $app = new SDL::App (
41 -title => 'Application Title',
47 <p>This is the manual way of doing things </p>
48 <pre> my $event = new SDL::Event; # create a new event
53 while ($event->wait()) {
54 my $type = $event->type(); # get event type
56 exit if $type == SDL_QUIT;
58 An alternative to the manual Event processing is the L<SDL::App::loop> .
63 <h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
64 <div id="DESCRIPTION_CONTENT">
65 <p><cite>SDL::App</cite> controls the root window of the of your SDL based application.
66 It extends the <cite>SDL::Surface</cite> class, and provides an interface to the window
67 manager oriented functions.</p>
70 <h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
71 <div id="METHODS_CONTENT">
75 <div id="new_CONTENT">
76 <p><code>SDL::App::new</code> initializes the SDL, creates a new screen,
77 and initializes some of the window manager properties.
78 <code>SDL::App::new</code> takes a series of named parameters:</p>
92 <h2 id="title">title</h2>
93 <div id="title_CONTENT">
94 <p><code>SDL::App::title</code> takes 0, 1, or 2 arguments. It returns the current
95 application window title. If one parameter is passed, both the window
96 title and icon title will be set to its value. If two parameters are
97 passed the window title will be set to the first, and the icon title
101 <h2 id="delay">delay</h2>
102 <div id="delay_CONTENT">
103 <p><code>SDL::App::delay</code> takes 1 argument, and will sleep the application for
107 <h2 id="ticks">ticks</h2>
108 <div id="ticks_CONTENT">
109 <p><code>SDL::App::ticks</code> returns the number of ms since the application began.</p>
112 <h2 id="error">error</h2>
113 <div id="error_CONTENT">
114 <p><code>SDL::App::error</code> returns the last error message set by the SDL.</p>
117 <h2 id="resize">resize</h2>
118 <div id="resize_CONTENT">
119 <p><code>SDL::App::resize</code> takes a new height and width of the application
120 if the application was originally created with the -resizable option.</p>
123 <h2 id="fullscreen">fullscreen</h2>
124 <div id="fullscreen_CONTENT">
125 <p><code>SDL::App::fullscreen</code> toggles the application in and out of fullscreen mode.</p>
128 <h2 id="iconify">iconify</h2>
129 <div id="iconify_CONTENT">
130 <p><code>SDL::App::iconify</code> iconifies the applicaiton window.</p>
133 <h2 id="grab_input">grab_input</h2>
134 <div id="grab_input_CONTENT">
135 <p><code>SDL::App::grab_input</code> can be used to change the input focus behavior of
136 the application. It takes one argument, which should be one of the following:</p>
147 <h2 id="loop">loop</h2>
148 <div id="loop_CONTENT">
149 <p><code>SDL::App::loop</code> is a simple event loop method which takes a reference to a hash
150 of event handler subroutines. The keys of the hash must be SDL event types such
151 as SDL_QUIT(), SDL_KEYDOWN(), and the like. The event method recieves as its parameter
152 the event object used in the loop.</p>
155 my $app = new SDL::App -title => "test.app",
161 SDL_QUIT() => sub { exit(0); },
162 SDL_KEYDOWN() => sub { print "Key Pressed" },
165 $app->loop(\%actions);
170 <h2 id="sync">sync</h2>
171 <div id="sync_CONTENT">
172 <p><code>SDL::App::sync</code> encapsulates the various methods of syncronizing the screen with the
173 current video buffer. <code>SDL::App::sync</code> will do a fullscreen update, using the double buffer
174 or OpenGL buffer if applicable. This is prefered to calling flip on the application window.</p>
177 <h2 id="attribute_attr_value">attribute ( attr, [value] )</h2>
178 <div id="attribute_attr_value_CONTENT">
179 <p><code>SDL::App::attribute</code> allows one to set and get GL attributes. By passing a value
180 in addition to the attribute selector, the value will be set. <code>SDL:::App::attribute</code>
181 always returns the current value of the given attribute, or croaks on failure.</p>
184 <h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
185 <div id="AUTHOR_CONTENT">
190 <h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
191 <div id="SEE_ALSO_CONTENT">
192 <p><cite>perl</cite> <cite>SDL::Surface</cite> <cite>SDL::Event</cite> <cite>SDL::OpenGL</cite></p>