1SDL(3)                User Contributed Perl Documentation               SDL(3)
2
3
4

NAME

6       SDL - Simple DirectMedia Layer for Perl
7

CATEGORY

9       Core
10

SYNOPSIS

12        use SDL;
13

DESCRIPTION

15       SDL_perl is a package of Perl modules that provide both functional and
16       object oriented interfaces to the Simple DirectMedia Layer for Perl 5.
17       This package takes some liberties with the SDL API, and attempts to
18       adhere to the spirit of both the SDL and Perl.  This document describes
19       the low-level functional SDL Perl API.  For the object oriented
20       programming interface please see the documentation provided on a per-
21       class basis.
22

CONSTANTS

24       The constants are not exported by default. You can export them by
25       doing:
26
27        use SDL ':all';
28
29       or access them directly:
30
31        SDL::SDL_INIT_AUDIO;
32
33       or by choosing the export tags below:
34
35       Export tag: ':init'
36
37        SDL_INIT_AUDIO
38        SDL_INIT_VIDEO
39        SDL_INIT_CDROM
40        SDL_INIT_EVERYTHING
41        SDL_INIT_NOPARACHUTE
42        SDL_INIT_JOYSTICK
43        SDL_INIT_TIMER
44

METHODS

46   init
47        SDL::init( $flags );
48
49       As with the C language API, SDL Perl initializes the SDL environment
50       with the "SDL::init" subroutine.  This routine takes a mode flag
51       constructed through the bitwise OR product of the "SDL_INIT_*"
52       constants.  The $flags tell "SDL::init" which subsystems to initialize.
53
54        SDL::init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
55
56       "SDL::init" returns 0 on success, or "-1" on error.
57
58   init_sub_system
59        SDL::init_sub_system( $flags );
60
61       After SDL has been initialized with "SDL::init" you may initialize any
62       uninitialized subsystems with "SDL::init_sub_system".  The $flags tell
63       "SDL::init_sub_system" which subsystems to initialize, and are taken in
64       the same way as "SDL::init".
65
66       "SDL::init_sub_system" returns 0 on success, or "-1" on error.
67
68   quit_sub_system
69        SDL::quit_sub_system( $flags );
70
71       "SDL::quit_sub_system" allows you to shut down a subsystem that has
72       been previously initialized by "SDL::init" or "SDL::init_sub_system".
73       The $flags tell "SDL::quit_sub_system" which subsystems to shut down,
74       and are taken in the same way as "SDL::init".
75
76       "SDL::quit_sub_system" doesn't return any values.
77
78   quit
79        SDL::quit;
80
81       "SDL::quit" Shuts down all SDL subsystems, unloads the dynamically
82       linked library and frees the allocated resources.
83
84       Note: This will be called automatically when Perl exits. You don't need
85       to call this, except if you want to initialize SDL again after this.
86
87       "SDL::quit" doesn't return any values.
88
89   was_init
90        my $flags = SDL::was_init( $flags );
91
92       "SDL::was_init" allows you to see which SDL subsystems have been
93       initialized.  The $flags tell "SDL::was_init" which subsystems to
94       check, and are taken in the same way as "SDL::init".
95
96       "SDL::was_init" returns a mask of the initialized subsystems it checks.
97       If $flags is 0 or "SDL_INIT_EVERYTHING", a mask of all initialized
98       subsystems will be returned (this does not include
99       "SDL_INIT_EVENTTHREAD" or "SDL_INIT_NOPARACHUTE").
100
101        use SDL ':all';
102
103        my $mask = SDL::was_init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
104        if($mask & SDL_INIT_AUDIO and $mask & SDL_INIT_JOYSTICK) {
105            # Both subsystems are initialized!
106        }
107
108   get_error
109        my $error = SDL::get_error;
110
111       Returns a scalar value containing the last error message set by the SDL
112       library (if any).
113
114   set_error_real
115        SDL::set_error_real( $printf_format, @values )
116
117       "SDL::set_error_real" sets the SDL error to a "printf" style formatted
118       string.
119
120       "SDL::set_error_real" doesn't return any values.
121
122   clear_error
123        SDL::clear_error;
124
125       "SDL::clear_error" deletes all information about the last SDL error.
126       This is useful if the error has been handled by the program.
127
128       "SDL::clear_error" doesn't return any values.
129
130   version
131        my $version = SDL::version;
132
133       Returns an "SDL::Version" object of the SDL library at compile-time.
134
135        use SDL;
136        use SDL::Version;
137
138        my $v = SDL::version;
139        printf("got version: %d.%d.%d\n", $v->major, $v->minor, $v->patch);
140
141   linked_version
142       "SDL::linked_version" works in the same way as "SDL::version", but
143       returns an "SDL::Version" object of the SDL library at link-time.
144
145   get_ticks
146        my $ticks = SDL::get_ticks;
147
148       Returns the number of milliseconds since SDL library initialization.
149       This value wraps around if the program runs for more than 49.7 days
150
151   get_handle
152        my $win32_handle = SDL::get_handle;
153
154       A video surface must be inited to get a handle.
155
156   delay
157        SDL::delay( $ms );
158
159       "SDL::delay" waits the specified number of milliseconds before
160       returning.  The actual delay may be longer than specified depending on
161       the underlying OS.
162
163       "SDL::delay" doesn't return anything.
164
165        # Delay for half a second
166        SDL::delay(500);
167

SDL Manual: Getting Started

169       A new book has been started to provide a complete tutorial for SDL. See
170       <http://bit.ly/hvxc9V>.
171

AUTHORS

173   Project Founder
174       David J. Goehrig
175
176   Current Maintainers
177       Kartik Thakore (kthakore)
178
179       Tobias Leich (FROGGS)
180
181   Core Developers and Contributors
182       The following people have dedicated blood sweat and tears to making SDL
183       Perl possible.
184
185       See the impact graph <https://github.com/PerlGameDev/SDL/graphs/impact>
186       on our github repository.
187
188       Andy Bakun <sdlperl@thwartedefforts.org>
189
190       Benedikt Meurer <bmeurer@fwdn.de>
191
192       Blaise Roth (Blaizer) <blaizer@cpan.org>
193
194       Breno G. de Oliveira (garu)
195
196       Brian Cassidy (bricas)
197
198       chromatic <chromatic@wgz.org>
199
200       Daniel Mantovani <daniel.oliveira.mantovani@gmail.com>
201
202       Daniel Ruoso http://daniel.ruoso.com/
203
204       David J. Goehrig <dgoehrig@cpan.org>
205
206       Dustin Mays (dorkfish) <dork.fish.wat.@gmail.com>
207
208       Fedora
209
210       Gabor Szabo (szabgab) <szabgab@gmail.com>
211
212       Guillaue Cottenceau (gc) <gc@mandrakesoft.com>
213
214       Heikki MehtA~nen (hmehta/hejki) <heikki@mehtanen.fi>
215
216       James King
217
218       James Wright <jwright@cpan.org>
219
220       Jeffrey T. Palmer (jtpalmer) <jeffrey.t.palmer@gmail.com>
221
222       Kartik Thakore (kthakore) <thakore.kartik@gmail.com>
223
224       KatrinaTheLamia
225
226       kmx <kmx@cpan.org>
227
228       Luke
229
230       Michael Lamertz <mike@perl-ronin.de>
231
232       morgoth.666
233
234       Peter BARABAS <z0d@artifact.hu>
235
236       Russell Valentine <russ_allegro@yahoo.com>
237
238       Ryan Hanlon
239
240       Stephane Desneux <sdx@desneux.com>
241
242       Tels <http://www.bloodgate.com>
243
244       Thomas Tongue
245
246       Tobias Leich (FROGGS)
247
248       Tony C
249
250       Yuval Kogman (nothingmuch)
251
252       Wayne Keenan <wayne@metaverse.fsnet.co.uk>
253
254       If you would like to contribute to SDL Perl, please post a message on
255       the mailing list:
256
257       sdl-devel@perl.org
258
259       And request access to the github repository. Or drop us a line on #sdl
260       over at irc.perl.org
261
263       Copyright 2002-2010 SDL Authors as listed above, all rights reserved.
264
265       This program is free software; you can redistribute it and/or modify it
266       under the same terms as Perl itself.
267

DISCLAIMER OF WARRANTY

269       BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
270       FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
271       WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
272       PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
273       EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
274       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
275       ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
276       YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
277       NECESSARY SERVICING, REPAIR, OR CORRECTION.
278
279       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
280       WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
281       REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
282       TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
283       CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
284       SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
285       RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
286       FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
287       SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
288       DAMAGES.
289
290
291
292perl v5.32.0                      2020-07-28                            SDL(3)
Impressum