pods::SDL(3pm)
π SDL β Simple DirectMedia Layer for Perl π
Hey bestie, so this is pods::SDL(3pm) β a Perl manual page (that's what the 3pm bit means, iykyk). Welcome to the low-level functional SDL Perl API. Buckle up π
β¨ CATEGORY β¨
Core β yeah, it's literally the core. Main character energy only π
β¨ SYNOPSIS β¨
use SDL;
That's it. That's the whole vibe check. π¦
β¨ DESCRIPTION β¨
Okay so SDL_perl is a whole package of Perl modules giving you both functional and object oriented interfaces to the Simple DirectMedia Layer, for Perl 5. It takes some liberties with the SDL API (iconic of it, honestly) and genuinely tries to stick to the spirit of both SDL and Perl at the same time. π
This document right here describes the low-level functional SDL Perl API. If you want the object oriented programming interface, no worries β go peek at the docs provided on a per-class basis. π«Ά
β¨ CONSTANTS β¨
Heads up bestie: the constants are not exported by default. Rude, I know π. You can export them by doing this:
use SDL ':all';
Or you can access them directly, like:
SDL::SDL_INIT_AUDIO;
Or you can pick and choose using the export tags below:
Export tag: ':init'
SDL_INIT_AUDIOSDL_INIT_VIDEOSDL_INIT_CDROMSDL_INIT_EVERYTHINGSDL_INIT_NOPARACHUTESDL_INIT_JOYSTICKSDL_INIT_TIMER
β¨ METHODS β¨
πΈ init
SDL::init( $flags );
Just like the C language API does it, SDL Perl initializes the SDL environment with the SDL::init subroutine. This routine takes a mode flag that you build by bitwise-OR-ing the SDL_INIT_* constants together. The $flags are literally telling SDL::init which subsystems to initialize. β¨
SDL::init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
SDL::init returns 0 on success, or -1 on error. Slay.
πΈ init_sub_system
SDL::init_sub_system( $flags );
So once SDL has already been initialized with SDL::init, you can initialize any uninitialized subsystems with SDL::init_sub_system. The $flags tell SDL::init_sub_system which subsystems to initialize, and they're taken in exactly the same way as SDL::init. π
SDL::init_sub_system returns 0 on success, or -1 on error.
πΈ quit_sub_system
SDL::quit_sub_system( $flags );
SDL::quit_sub_system lets you shut down a subsystem that was previously initialized by SDL::init or SDL::init_sub_system. The $flags tell SDL::quit_sub_system which subsystems to shut down, and they're taken in the same way as SDL::init. π
SDL::quit_sub_system doesn't return any values.
πΈ quit
SDL::quit;
SDL::quit shuts down all SDL subsystems, unloads the dynamically linked library, and frees the allocated resources. Bye bestie π
Note: 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. π
SDL::quit doesn't return any values.
πΈ was_init
my $flags = SDL::was_init( $flags );
SDL::was_init lets you see which SDL subsystems have actually been initialized. The $flags tell SDL::was_init which subsystems to check, and they're taken in the same way as SDL::init. π
SDL::was_init returns a mask of the initialized subsystems it checks. If $flags is 0 or SDL_INIT_EVERYTHING, then a mask of all initialized subsystems will be returned β and just so you know, this does not include SDL_INIT_EVENTTHREAD or SDL_INIT_NOPARACHUTE. π
use SDL ':all';
my $mask = SDL::was_init(SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
if($mask & SDL_INIT_AUDIO and $mask & SDL_INIT_JOYSTICK) {
# Both subsystems are initialized!
}
πΈ get_error
my $error = SDL::get_error;
Returns a scalar value containing the last error message set by the SDL library β if there even is one. π
πΈ set_error_real
SDL::set_error_real( $printf_format, @values )
SDL::set_error_real sets the SDL error to a printf style formatted string. Cute and formatted. π
SDL::set_error_real doesn't return any values.
πΈ clear_error
SDL::clear_error;
SDL::clear_error deletes all information about the last SDL error. Super useful if the error has already been handled by the program β no need to keep that baggage around, we're moving on π
SDL::clear_error doesn't return any values.
πΈ version
my $version = SDL::version;
Returns an SDL::Version object of the SDL library at compile-time. β
use SDL;
use SDL::Version;
my $v = SDL::version;
printf("got version: %d.%d.%d\n", $v->major, $v->minor, $v->patch);
πΈ linked_version
SDL::linked_version works in the same way as SDL::version, except it returns an SDL::Version object of the SDL library at link-time. Same energy, different timestamp π¦
πΈ get_ticks
my $ticks = SDL::get_ticks;
Returns the number of milliseconds since the SDL library was initialized. Fun little detail: this value wraps around if the program runs for more than 49.7 days. π³ Yeah. 49.7. Remember that number.
πΈ get_handle
my $win32_handle = SDL::get_handle;
A video surface must be inited to get a handle. No surface, no handle, periodt. π«Ά
πΈ delay
SDL::delay( $ms );
SDL::delay waits the specified number of milliseconds before returning. Ngl though, the actual delay may end up longer than what you specified, depending on the underlying OS. Blame the OS, not us π€
SDL::delay doesn't return anything.
# Delay for half a second
SDL::delay(500);
β¨ SDL Manual: Getting Started β¨
A whole new book has been started to give you a complete tutorial for SDL. Go look: <http://bit.ly/hvxc9V> π
β¨ AUTHORS β¨
π Project Founder
David J. Goehrig
π Current Maintainers
- Kartik Thakore (kthakore)
- Tobias Leich (FROGGS)
π Core Developers and Contributors
The following people have dedicated blood, sweat and tears to making SDL Perl possible. Genuinely obsessed with them. ππ
See the impact graph <https://github.com/PerlGameDev/SDL/graphs/impact> on our github repository.
- Andy Bakun <sdlperl@thwartedefforts.org>
- Benedikt Meurer <bmeurer@fwdn.de>
- Blaise Roth (Blaizer) <blaizer@cpan.org>
- Breno G. de Oliveira (garu)
- Brian Cassidy (bricas)
- chromatic <chromatic@wgz.org>
- Daniel Mantovani <daniel.oliveira.mantovani@gmail.com>
- Daniel Ruoso http://daniel.ruoso.com/
- David J. Goehrig <dgoehrig@cpan.org>
- Dustin Mays (dorkfish) <dork.fish.wat.@gmail.com>
- Fedora
- Gabor Szabo (szabgab) <szabgab@gmail.com>
- Guillaue Cottenceau (gc) <gc@mandrakesoft.com>
- Heikki MehtΓnen (hmehta/hejki) <heikki@mehtanen.fi>
- James King
- James Wright <jwright@cpan.org>
- Jeffrey T. Palmer (jtpalmer) <jeffrey.t.palmer@gmail.com>
- Kartik Thakore (kthakore) <thakore.kartik@gmail.com>
- KatrinaTheLamia
- kmx <kmx@cpan.org>
- Luke
- Michael Lamertz <mike@perl-ronin.de>
- morgoth.666
- Peter BARABAS <z0d@artifact.hu>
- Russell Valentine <russ_allegro@yahoo.com>
- Ryan Hanlon
- Stephane Desneux <sdx@desneux.com>
- Tels <http://www.bloodgate.com>
- Thomas Tongue
- Tobias Leich (FROGGS)
- Tony C
- Yuval Kogman (nothingmuch)
- Wayne Keenan <wayne@metaverse.fsnet.co.uk>
If you would like to contribute to SDL Perl, please post a message on the mailing list:
sdl-devel@perl.org
And request access to the github repository. Or just drop us a line on #sdl over at irc.perl.org. Come hang out, we don't bite π§β¨
β¨ COPYRIGHT & LICENSE β¨
Copyright 2002-2010 SDL Authors as listed above, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
β¨ DISCLAIMER OF WARRANTY β¨
Okay bestie, legal voice time β this part is serious and you gotta read it, no cap. π«Ά
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. π
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
π aaaand that's the page! this one's from perl v5.42.3, dated 2026-08-19, and it lives at pods::SDL(3pm) β go make something iconic with it π
β¨π
π¦ where this page comes from
- ubuntu stonking: libsdl-perl 2.548-6build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms