SDL_perl - Simple DirectMedia Layer for Perl |
Init(flags)
GetError()
Delay(ms)
GetTicks()
AddTimer(interval,callback,param)
NewTimer(interval,subroutine)
RemoveTimer(id)
CDNumDrives()
CDName(drive)
CDOpen(drive)
CDTrackListing(cd)
CDTrackId(track)
CDTrackType(track)
CDTrackLength(track)
CDTrackOffset(track)
CDStatus(cd)
CDPlayTracks(cd,track,tracks,frame,frames)
CDPlay(cd,track,length)
CDPause(cd)
CDResume(cd)
CDStop(cd)
CDEject(cd)
CDClose(cd)
FillRect(surface,rect,color)
SDL_perl - Simple DirectMedia Layer for Perl
use SDL;
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.
Init(flags)
As with the C language API, SDL_perl initializes the SDL environment through
the SDL::Init
subroutine. This routine takes a mode flag constructed through
the bitwise OR product of the following functions:
INIT_AUDIO()
INIT_VIDEO()
INIT_CDROM()
INIT_EVERYTHING()
INIT_NOPARACHUTE()
INIT_JOYSTICK()
INIT_TIMER()
SDL::Init
returns 0 on success, or -1 on error.
GetError()
The last error message set by the SDL library can be retrieved using the subroutine
SDL::GetError
, which returns a scalar containing the text of the message if any.
Delay(ms)
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.
GetTicks()
An application may retrieve the number of milliseconds expired since the initilization of the application through this subroutine. This value resets rougly ever 49 days.
AddTimer(interval,callback,param)
AddTimer
will register a SDL_NewTimerCallback function to be executed after
interval
milliseconds, with parameter param
. SDL_NewTimerCallback objects
can be constructed with the NewTimer
subroutine. SDL::PerlTimerCallback
will return a valid callback for executing a perl subroutine or closure.
This subroutine returns a SDL_TimerID for the newly registered callback, or NULL
on error.
NewTimer(interval,subroutine)
The NewTimer
takes an interval in milliseconds and a reference to a subroutine
to call at that interval. The subroutine will be invoked in a void context
and accepts no parameters. The callback used is that returned by SDL::PerlTimerCallback
.
NewTimer
returns the SDL_TimerID for the new timer or NULL on error.
RemoveTimer(id)
This subroutine taks a SDL_TimerID and removes it from the list of active callbacks. RemoveTimer returns false on failure.
This subroutine is depreciated, please use NewTimer
or AddTimer
instead.
CDNumDrives()
SDL::CDNumDrives
returns the number of available CD-ROM drives in the system.
CDName(drive)
The subroutine SDL::CDName
returns the system specific human readable device name
for the given CD-ROM drive.
CDOpen(drive)
This subroutine opens a CD-ROM drive for access, returning NULL if the drive is busy or otherwise unavailable. On success this subroutine returns a handle to the CD-ROM drive.
CDTrackListing(cd)
SDL::CDTrackListing
returns a human readable description of a CD-ROM. For each
track one line will be produced with the following format:
Track index: %d, id %d, %2d.%2d
This is provided to ease the creation of human readable descriptions and debugging.
CDTrackId(track)
CDTrackId
returns the id field of the given SDL_CDtrack structure.
CDTrackType(track)
CDTrackType
returns the type field of the given SDL_CDtrack structure.
CDTrackLength(track)
CDTrackLength
returns the length field of the given SDL_CDtrack structure.
CDTrackOffset(track)
CDTrackOffset
returns the offset field of the given SDL_CDtrack structure.
CDStatus(cd)
The function CDStatus
returns the current status of the given SDL_CDrom.
CDStatus
's return values are:
CDPlayTracks(cd,track,tracks,frame,frames)
To start playing from an arbitrary portion of a CD, one can provide
SDL::CDPlayTracks
with a CD, a starting track, the number of tracks,
a starting frame, and the number of frames to be played.
CDPlay(cd,track,length)
SDL::CDPlay
plays the next length
tracks starting from track
CDPause(cd)
This function will pause CD playback until resume is called.
CDResume(cd)
This function will resume CD playback if paused.
CDStop(cd)
SDL::CDStop
will stop CD playback if playing.
CDEject(cd)
This function will eject the CD
CDClose(cd)
This function will release an opened CD.
SDL::MapRGB
translates the composite red (r), green (g), blue (b)
colors according to the given surface to a interger color value. This
integer can be used in functions like SDL::FillRect
, and is not
the same as the format independent Color object returned by SDL::NewColor
.
SDL::MapRGBA
works as SDL::MapRGB
but takes an additional alpha (a)
component for semi-transperant colors.
FillRect(surface,rect,color)
C<SDL::FillRect> draws a solid rectangle of color on the given surface. If the rectangle is NULL, the entire surface will be painted.
David J. Goehrig
David J. Goehrig, Wayne Keenan, Guillaume Cottenceau
perl(1) SDL::App(3) SDL::Surface(3) SDL::Event(3) SDL::Rect(3) SDL::Palette(3) SDL::Mixer(3) SDL::Cdrom(3)
SDL_perl - Simple DirectMedia Layer for Perl |