3 <h3 id="TOP">Index</h3>
5 <ul><li><a href="#NAME">NAME</a></li>
6 <li><a href="#CATEGORY">CATEGORY</a></li>
7 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
8 <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
9 <li><a href="#CONSTANTS">CONSTANTS</a></li>
10 <li><a href="#METHODS">METHODS</a>
11 <ul><li><a href="#init">init</a></li>
12 <li><a href="#init_subsystem">init_subsystem</a></li>
13 <li><a href="#quit_subsystem">quit_subsystem</a></li>
14 <li><a href="#quit">quit</a></li>
15 <li><a href="#was_init">was_init</a></li>
16 <li><a href="#get_error">get_error</a></li>
17 <li><a href="#set_error_real">set_error_real</a></li>
18 <li><a href="#clear_error">clear_error</a></li>
19 <li><a href="#version">version</a></li>
20 <li><a href="#linked_version">linked_version</a></li>
21 <li><a href="#get_ticks">get_ticks</a></li>
22 <li><a href="#get_handle">get_handle</a></li>
23 <li><a href="#delay">delay</a></li>
26 <li><a href="#SDL_Manual_Getting_Started">SDL Manual: Getting Started</a></li>
27 <li><a href="#AUTHORS">AUTHORS</a>
28 <ul><li><a href="#Project_Founder">Project Founder</a></li>
29 <li><a href="#Current_Maintainers">Current Maintainers</a></li>
30 <li><a href="#Core_Developers_and_Contributors">Core Developers and Contributors</a></li>
33 <li><a href="#COPYRIGHT_amp_LICENSE">COPYRIGHT & LICENSE</a></li>
34 <li><a href="#DISCLAIMER_OF_WARRANTY">DISCLAIMER OF WARRANTY</a>
39 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
40 <div id="NAME_CONTENT">
41 <p>SDL - Simple DirectMedia Layer for Perl</p>
44 <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
45 <div id="CATEGORY_CONTENT">
49 <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
50 <div id="SYNOPSIS_CONTENT">
56 <h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
57 <div id="DESCRIPTION_CONTENT">
58 <p>SDL_perl is a package of Perl modules that provide both functional and object oriented interfaces to the Simple DirectMedia Layer for Perl 5.
59 This package takes some liberties with the SDL API, and attempts to adhere to the spirit of both the SDL and Perl.
60 This document describes the low-level functional SDL Perl API.
61 For the object oriented programming interface please see the documentation provided on a per-class basis.</p>
64 <h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
65 <div id="CONSTANTS_CONTENT">
66 <p>The constants are not exported by default. You can export them by doing:</p>
70 <p>or access them directly:</p>
71 <pre> SDL::SDL_INIT_AUDIO;
74 <p>or by choosing the export tags below:</p>
75 <p>Export tag: ':init'</p>
87 <h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
88 <div id="METHODS_CONTENT">
91 <h2 id="init">init</h2>
92 <div id="init_CONTENT">
93 <pre> SDL::init( $flags );
96 <p>As with the C language API, SDL Perl initializes the SDL environment with the <code>SDL::init</code> subroutine.
97 This routine takes a mode flag constructed through the bitwise OR product of the <code>SDL_INIT_*</code> constants.
98 The <code>$flags</code> tell <code>SDL::init</code> which subsystems to initialize.</p>
99 <pre> SDL::init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
102 <p><code>SDL::init</code> returns <code>0</code> on success, or <code>-1</code> on error.</p>
105 <h2 id="init_subsystem">init_subsystem</h2>
106 <div id="init_subsystem_CONTENT">
107 <pre> SDL::init_subsystem( $flags );
110 <p>After SDL has been initialized with <code>SDL::init</code> you may initialize any uninitialized subsystems with <code>SDL::init_subsystem</code>.
111 The <code>$flags</code> tell <code>SDL::init_subsystem</code> which subsystems to initialize, and are taken in the same way as <code>SDL::init</code>.</p>
112 <p><code>SDL::init_subsystem</code> returns <code>0</code> on success, or <code>-1</code> on error.</p>
115 <h2 id="quit_subsystem">quit_subsystem</h2>
116 <div id="quit_subsystem_CONTENT">
117 <pre> SDL::quit_subsystem( $flags );
120 <p><code>SDL::quit_subsystem</code> allows you to shut down a subsystem that has been previously initialized by <code>SDL::init</code> or <code>SDL::init_subsystem</code>.
121 The <code>$flags</code> tell <code>SDL::quit_subsystem</code> which subsystems to shut down, and are taken in the same way as <code>SDL::init</code>.</p>
122 <p><code>SDL::quit_subsystem</code> doesn't return any values.</p>
125 <h2 id="quit">quit</h2>
126 <div id="quit_CONTENT">
130 <p><code>SDL::quit</code> Shuts down all SDL subsystems, unloads the dynamically linked library and frees the allocated resources.</p>
131 <p><strong>Note:</strong> This will be called automatically when Perl exits. You don't need to call this, except if you want to initialize SDL again after this.</p>
132 <p><code>SDL::quit</code> doesn't return any values.</p>
135 <h2 id="was_init">was_init</h2>
136 <div id="was_init_CONTENT">
137 <pre> my $flags = SDL::was_init( $flags );
140 <p><code>SDL::was_init</code> allows you to see which SDL subsytems have been initialized.
141 The <code>$flags</code> tell <code>SDL::was_init</code> which subsystems to check, and are taken in the same way as <code>SDL::init</code>.</p>
142 <p><code>SDL::was_init</code> returns a mask of the initialized subsystems it checks.
143 If <code>$flags</code> is <code>0</code> or <code>SDL_INIT_EVERYTHING</code>, a mask of all initialized subsystems will be returned (this does not include <code>SDL_INIT_EVENTTHREAD</code> or <code>SDL_INIT_NOPARACHUTE</code>).</p>
144 <pre> use SDL ':all';
146 my $mask = SDL::was_init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
147 if($mask & SDL_INIT_AUDIO and $mask & SDL_INIT_JOYSTICK) {
148 # Both subsystems are initialized!
154 <h2 id="get_error">get_error</h2>
155 <div id="get_error_CONTENT">
156 <pre> my $error = SDL::get_error;
159 <p>Returns a scalar value containing the last error message set by the SDL library (if any).</p>
162 <h2 id="set_error_real">set_error_real</h2>
163 <div id="set_error_real_CONTENT">
164 <pre> SDL::set_error_real( $printf_format, @values )
167 <p><code>SDL::set_error_real</code> sets the SDL error to a <code>printf</code> style formatted string.</p>
168 <p><code>SDL::set_error_real</code> doesn't return any values.</p>
171 <h2 id="clear_error">clear_error</h2>
172 <div id="clear_error_CONTENT">
173 <pre> SDL::clear_error;
176 <p><code>SDL::clear_error</code> deletes all information about the last SDL error.
177 This is useful if the error has been handled by the program.</p>
178 <p><code>SDL::clear_error</code> doesn't return any values.</p>
181 <h2 id="version">version</h2>
182 <div id="version_CONTENT">
183 <pre> my $version = SDL::version;
186 <p>Returns an <code>SDL::Version</code> object of the SDL library at compile-time.</p>
190 my $v = SDL::version;
191 printf("got version: %d.%d.%d\n", $v->major, $v->minor, $v->patch);
196 <h2 id="linked_version">linked_version</h2>
197 <div id="linked_version_CONTENT">
198 <p><code>SDL::linked_version</code> works in the same way as <code>SDL::version</code>, but returns an <code>SDL::Version</code> object of the SDL library at link-time.</p>
201 <h2 id="get_ticks">get_ticks</h2>
202 <div id="get_ticks_CONTENT">
203 <pre> my $ticks = SDL::get_ticks;
206 <p>Returns the number of milliseconds since SDL library initialization.
207 This value wraps around if the program runs for more than 49.7 days</p>
210 <h2 id="get_handle">get_handle</h2>
211 <div id="get_handle_CONTENT">
212 <pre> my $win32_handle = SDL::get_handle;
215 <p>A video surface must be inited to get a handle. </p>
218 <h2 id="delay">delay</h2>
219 <div id="delay_CONTENT">
220 <pre> SDL::delay( $ms );
223 <p><code>SDL::delay</code> waits the specified number of milliseconds before returning.
224 The actual delay may be longer than specified depending on the underlying OS.</p>
225 <p><code>SDL::delay</code> doesn't return anything.</p>
226 <pre> # Delay for half a second
232 <h1 id="SDL_Manual_Getting_Started">SDL Manual: Getting Started</h1><p><a href="#TOP" class="toplink">Top</a></p>
233 <div id="SDL_Manual_Getting_Started_CONTENT">
234 <p>A new book has been started to provide a complete tutorial for SDL. See <a href="http://bit.ly/hvxc9V">http://bit.ly/hvxc9V</a>.</p>
237 <h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
238 <div id="AUTHORS_CONTENT">
241 <h2 id="Project_Founder">Project Founder</h2>
242 <div id="Project_Founder_CONTENT">
243 <p>David J. Goehrig</p>
246 <h2 id="Current_Maintainers">Current Maintainers</h2>
247 <div id="Current_Maintainers_CONTENT">
248 <p>Kartik Thakore (kthakore)</p>
249 <p>Tobias Leich (FROGGS)</p>
252 <h2 id="Core_Developers_and_Contributors">Core Developers and Contributors</h2>
253 <div id="Core_Developers_and_Contributors_CON">
254 <p>The following people have dedicated blood sweat and tears to making SDL Perl possible.</p>
255 <p>See the <a href="http://github.com/kthakore/SDL_perl/graphs/impact">impact graph</a> on our github repository.</p>
256 <p>Andy Bakun <sdlperl@thwartedefforts.org></p>
257 <p>Benedikt Meurer <bmeurer@fwdn.de></p>
258 <p>Blaise Roth (Blaizer) <blaizer@cpan.org></p>
259 <p>Breno G. de Oliveira (garu)</p>
260 <p>Brian Cassidy (bricas)</p>
261 <p>chromatic <chromatic@wgz.org></p>
262 <p>Daniel Mantovani <daniel.oliveira.mantovani@gmail.com></p>
263 <p>Daniel Ruoso http://daniel.ruoso.com/</p>
264 <p>David J. Goehrig <dgoehrig@cpan.org></p>
265 <p>Dustin Mays (dorkfish) <dork.fish.wat.@gmail.com></p>
267 <p>Gabor Szabo (szabgab) <szabgab@gmail.com></p>
268 <p>Guillaue Cottenceau (gc) <gc@mandrakesoft.com></p>
269 <p>Heikki Meht&195;nen (hmehta/hejki) <heikki@mehtanen.fi></p>
271 <p>James Wright <jwright@cpan.org></p>
272 <p>Jeffrey T. Palmer (jtpalmer) <jeffrey.t.palmer@gmail.com></p>
273 <p>Kartik Thakore (kthakore) <thakore.kartik@gmail.com></p>
274 <p>KatrinaTheLamia</p>
275 <p>kmx <kmx@cpan.org></p>
277 <p>Michael Lamertz <mike@perl-ronin.de></p>
279 <p>Peter BARABAS <z0d@artifact.hu></p>
280 <p>Russell Valentine <russ_allegro@yahoo.com></p>
282 <p>Stephane Desneux <sdx@desneux.com></p>
283 <p>Tels <http://www.bloodgate.com></p>
285 <p>Tobias Leich (FROGGS)</p>
287 <p>Yuval Kogman (nothingmuch)</p>
288 <p>Wayne Keenan <wayne@metaverse.fsnet.co.uk></p>
289 <p>If you would like to contribute to SDL Perl, please post a message on the mailing list:</p>
290 <p>sdl-devel@perl.org</p>
291 <p>And request access to the github repository. Or drop us a line on #sdl over at irc.perl.org</p>
294 <h1 id="COPYRIGHT_amp_LICENSE">COPYRIGHT & LICENSE</h1><p><a href="#TOP" class="toplink">Top</a></p>
295 <div id="COPYRIGHT_amp_LICENSE_CONTENT">
296 <p>Copyright 2002-2010 SDL Authors as listed above, all rights reserved.</p>
297 <p>This program is free software; you can redistribute it and/or modify it
298 under the same terms as Perl itself.</p>
301 <h1 id="DISCLAIMER_OF_WARRANTY">DISCLAIMER OF WARRANTY</h1><p><a href="#TOP" class="toplink">Top</a></p>
302 <div id="DISCLAIMER_OF_WARRANTY_CONTENT">
303 <p>BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
304 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
305 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
306 PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
307 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
308 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
309 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
310 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
311 NECESSARY SERVICING, REPAIR, OR CORRECTION.</p>
312 <p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
313 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
314 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
315 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
316 OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
317 THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
318 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
319 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
320 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF