=pod

=head1 NAME

SDL - Simple DirectMedia Layer for Perl

=head2 CATEGORY

Core

=head1 SYNOPSIS

  use SDL ':all';

=head1 DESCRIPTION

SDL_perl is a package of perl modules that provides both functional and object orient
interfaces to the Simple DirectMedia Layer for Perl 5.  This package does take some
liberties with the SDL API, and attempts to adhere to the spirit of both the SDL
and Perl.  This document describes the low-level functional SDL_perl API.  For the
object oriented programming interface please see the documentation provided on a
per class basis.

=head1 Functions exported by SDL.pm

=head2 init(flags) 

As with the C language API, SDL_perl initializes the SDL environment through
the C<SDL::init> subroutine. This routine takes a mode flag constructed through
the bitwise OR product of the SDL_INIT_* constants.

The constants are not exported by default. You can export them into your namespace by doing:

 use SDL ':all';

or access them directly:

 SDL::SDL_INIT_AUDIO;

or by choosing the export tags below:

Export tag: ':init'

=over 4

=item *
SDL_INIT_AUDIO

=item *
SDL_INIT_VIDEO

=item *
SDL_INIT_CDROM

=item *
SDL_INIT_EVERYTHING

=item *
SDL_INIT_NOPARACHUTE

=item *
SDL_INIT_JOYSTICK

=item *
SDL_INIT_TIMER

=back

C<SDL::Init> returns 0 on success, or -1 on error.

=head2 init_subsystem(flags)

After SDL has been initialized with SDL::init you may initialize uninitialized subsystems with SDL::init_subsystem.
The flags parameter is the same as that used in SDL::init. 

SDL::init_subsystem returns 0 on success, or -1 on error.

=head2 quit_subsystem(flags)

SDL::quit_subsystem allows you to shut down a subsystem that has been previously initialized by SDL::init or SDL::init_subsystem.
The flags tells SDL::quit_subSystem which subsystems to shut down, it uses the same values that are passed to SDL::init. 

SDL::quit_subsystem doesn't returns any value.

=head2 quit

Shuts down all SDL subsystems, unloads the dynamically linked library and frees the allocated resources.

B<Note>: This will be called automatically when perl exits. You don't need to call this, except you want to initialize SDL after this again.

SDL::quit doesn't returns any value.

=head2 was_init(flags)

SDL::was_init allows you to see which SDL subsytems have been initialized.
flags is a bitwise OR'd combination of the subsystems you wish to check (see SDL::init for a list of subsystem flags). 
If 'flags' is 0 or SDL_INIT_EVERYTHING, it returns a mask of all initialized subsystems (this does not include SDL_INIT_EVENTTHREAD or SDL_INIT_NOPARACHUTE).

=head2 get_error()

The last error message set by the SDL library can be retrieved using the subroutine
C<SDL::get_error>, which returns a scalar containing the text of the message if any.

=head2 set_error_real(error, @values)

SDL::set_error_real sets the SDL error to a printf style formatted string. 
it doesn't returns any values.

=head2 clear_error()

SDL::clear_error deletes all information about the last SDL error. Useful if the error has been handled by the program.
it doesn't returns any value.

=head2 version()

 my $version = SDL::version();

Returns an SDL::Version object of the of the SDL library at compile time.

Example:

 use SDL;
 use SDL::Version;
 
 my $v = SDL::version();
 printf("got version: %d.%d.%d\n", $v->major, $v->minor, $v->patch);


=head2 linked_version

 my $linked_version = SDL::linked_version();

Returns an SDL::Version object of the currently loaded SDL library.

Example:

 use SDL;
 use SDL::Version;
 
 my $v = SDL::linked_version();
 printf("got version: %d.%d.%d\n", $v->major, $v->minor, $v->patch);

=head2 get_error()

The last error message set by the SDL library can be retrieved using the subroutine
C<SDL::get_error>, which returns a scalar containing the text of the message if any.

=head2 delay(ms)

 SDL::delay(1000);

This subroutine allows an application to delay further operations for atleast a
number of milliseconds provided as the argument.  The actual delay may be longer
than the specified depending on the underlying OS.

=head1 AUTHORS

magnet, kthakore
