X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSDL.pm;h=d51344b90623e315b3f22513a25ccc22128fb6fb;hb=f53193aa2a17c507fbbeabdf86307f15277c5348;hp=3bc998f4e2c016813eaeaa1020a0bc2ac4a8d502;hpb=49045f0eba2e0a7e1177c8ee5640771c23dc801b;p=sdlgit%2FSDL_perl.git diff --git a/lib/SDL.pm b/lib/SDL.pm index 3bc998f..d51344b 100644 --- a/lib/SDL.pm +++ b/lib/SDL.pm @@ -1,10 +1,39 @@ +#!/usr/bin/env perl # -# Copyright (C) 2004 David J. Goehrig +# SDL.pm +# +# Copyright (C) 2005 David J. Goehrig +# +# ------------------------------------------------------------------------------ +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# ------------------------------------------------------------------------------ +# +# Please feel free to send questions, suggestions or improvements to: +# +# David J. Goehrig +# dgoehrig@cpan.org # package SDL; use strict; +use warnings; +use Carp; + use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); require Exporter; @@ -16,18 +45,20 @@ use SDL::Constants; BEGIN { @ISA = qw(Exporter DynaLoader); @EXPORT = qw( in verify &NULL ); - # reexport all SDL constants - for (@SDL::Constants::EXPORT) { - push @EXPORT,$_; - } }; +# Give our caller SDL::Constant's stuff as well as ours. +sub import { + my $self = shift; -$VERSION = '2.1.3'; + $self->export_to_level(1, @_); + SDL::Constants->export_to_level(1); +} +$VERSION = '2.2.2.17'; print "$VERSION" if (defined($ARGV[0]) && ($ARGV[0] eq '--SDLperl')); -$SDL::DEBUG=1; +$SDL::DEBUG=0; sub NULL { return 0; @@ -35,13 +66,17 @@ sub NULL { sub in { my ($k,@t) = @_; - (scalar grep { defined $_ && $_ eq $k } @t) <=> 0; + return 0 unless defined $k; + my $r = ((scalar grep { defined $_ && $_ eq $k } @t) <=> 0); + return 0 if $r eq ''; + return $r; + } sub verify (\%@) { my ($options,@valid_options) = @_; for (keys %$options) { - die "Invalid option $_\n" unless in ($_, @valid_options); + croak "Invalid option $_\n" unless in ($_, @valid_options); } } @@ -630,385 +665,4 @@ This function will release an opened CD. =head2 SurfaceBitsPerPixel -=head2 SurfaceBytesPerPixel - -=head2 SurfaceRshift - -=head2 SurfaceGshift - -=head2 SurfaceBshift - -=head2 SurfaceAshift - -=head2 SurfaceRmask - -=head2 SurfaceGmask - -=head2 SurfaceBmask - -=head2 SurfaceAmask - -=head2 SurfaceColorKey - -=head2 SurfaceAlpha - -=head2 SurfaceW - -=head2 SurfaceH - -=head2 SurfacePitch - -=head2 SurfacePixels - -=head2 SurfacePixel - -=head2 MUSTLOCK - -=head2 SurfaceLock - -=head2 SurfaceUnlock - -=head2 GetVideoSurface - -=head2 VideoInfo - -=head2 NewRect - -=head2 FreeRect - -=head2 RectX - -=head2 RectY - -=head2 RectW - -=head2 RectH - -=head2 NewColor - -=head2 ColorR - -=head2 ColorG - -=head2 CologB - -=head2 FreeColor - -=head2 NewPalette - -=head2 PaletteNColors - -=head2 PaletteColors - -=head2 SWSURFACE - -=head2 HWSURFACE - -=head2 ANYFORMAT - -=head2 HWPALETTE - -=head2 DOUBLEBUF - -=head2 FULLSCREEN - -=head2 ASYNCBLIT - -=head2 OPENGL - -=head2 HWACCEL - -=head2 VideoModeOK - -=head2 SetVideoMode - -=head2 UpdateRects - -=head2 Flip - -=head2 SetColors - -=head2 MapRGB (surface,r,g,b) - -C 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 C, and is not -the same as the format independent Color object returned by C. - -=head2 MapRGBA (surface,r,g,b,a) - -C works as C but takes an additional alpha (a) -component for semi-transperant colors. - -=head2 GetRGB - -=head2 GetRGBA - -=head2 SaveBMP - -=head2 SetColorKey - -=head2 SRCCOLORKEY - -=head2 RLEACCEL - -=head2 SRCALPHA - -=head2 SetAlpha - -=head2 DisplayFormat - -=head2 BlitSurface - -=head2 FillRect(surface,rect,color) - -C draws a solid rectangle of color on the given surface. -If the rectangle is NULL, the entire surface will be painted. - -=head2 WMSetCaption - -=head2 WMGetCaption - -=head2 WMSetIcon - -=head2 WarpMouse - -=head2 NewCursor - -=head2 FreeCursor - -=head2 SetCursor - -=head2 GetCursor - -=head2 ShowCursor - -=head2 NewAudioSpec - -=head2 FreeAudioSpec - -=head2 AUDIO_U8 - -=head2 AUDIO_S8 - -=head2 AUDIO_U16 - -=head2 AUDIO_S16 - -=head2 AUDIO_U16MSB - -=head2 AUDIO_S16MSB - -=head2 NewAudioCVT - -=head2 FreeAudioCVT - -=head2 ConvertAudioData - -=head2 OpenAudio - -=head2 PauseAudio - -=head2 UnlockAudio - -=head2 CloseAudio - -=head2 FreeWAV - -=head2 LoadWAV - -=head2 MixAudio - -=head2 MIX_MAX_VOLUME - -=head2 MIX_DEFAULT_FREQUENCY - -=head2 MIX_DEFAULT_FORMAT - -=head2 MIX_DEFAULT_CHANNELS - -=head2 MIX_NO_FADING - -=head2 MIX_FADING_OUT - -=head2 MIX_FADING_IN - -=head2 MixOpenAudio - -=head2 MixAllocateChannels - -=head2 MixQuerySpec - -=head2 MixLoadWAV - -=head2 MixLoadMusic - -=head2 MixQuickLoadWAV - -=head2 MixFreeChunk - -=head2 MixFreeMusic - -=head2 MixSetPostMixCallback - -=head2 MixSetMusicHook - -=head2 MixSetMusicFinishedHook - -=head2 MixGetMusicHookData - -=head2 MixReverseChannels - -=head2 MixGroupChannel - -=head2 MixGroupChannels - -=head2 MixGroupAvailable - -=head2 MixGroupCount - -=head2 MixGroupOldest - -=head2 MixGroupNewer - -=head2 MixPlayChannel - -=head2 MixPlayChannelTimed - -=head2 MixPlayMusic - -=head2 MixFadeInChannel - -=head2 MixFadeInChannelTimed - -=head2 MixFadeInMusic - -=head2 MixVolume - -=head2 MixVolumeChunk - -=head2 MixVolumeMusic - -=head2 MixHaltChannel - -=head2 MixHaltGroup - -=head2 MixHaltMusic - -=head2 MixExpireChannel - -=head2 MixFadeOutChannel - -=head2 MixFadeOutGroup - -=head2 MixFadeOutMusic - -=head2 MixFadingMusic - -=head2 MixFadingChannel - -=head2 MixPause - -=head2 MixResume - -=head2 MixPaused - -=head2 MixPauseMusic - -=head2 MixResumeMusic - -=head2 MixRewindMusic - -=head2 MixPausedMusic - -=head2 MixPlaying - -=head2 MixPlayingMusic - -=head2 MixCloseAudio - -=head2 NewFont - -=head2 UseFont - -=head2 PutString - -=head2 TextWidth - -=head2 GL_RED_SIZE - -=head2 GL_GREEN_SIZE - -=head2 GL_BLUE_SIZE - -=head2 GL_ALPHA_SIZE - -=head2 GL_ACCUM_RED_SIZE - -=head2 GL_ACCUM_GREEN_SIZE - -=head2 GL_ACCUM_BLUE_SIZE - -=head2 GL_ACCUM_ALPHA_SIZE - -=head2 GL_BUFFER_SIZE - -=head2 GL_DEPTH_SIZE - -=head2 GL_STENCIL_SIZE - -=head2 GL_DOUBLEBUFFER - -=head2 GL_SetAttribute - -=head2 GL_GetAttribute - -=head2 GL_SwapBuffers - -=head2 BigEndian - -=head2 NumJoysticks - -=head2 JoystickName - -=head2 JoystickOpen - -=head2 JoystickOpened - -=head2 JoystickIndex - -=head2 JoystickNumAxes - -=head2 JoystickNumBalls - -=head2 JoystickNumHats - -=head2 JoystickNumButtons - -=head2 JoystickUpdate - -=head2 JoystickGetAxis - -=head2 JoystickGetHat - -=head2 JoystickGetButton - -=head2 JoystickGetBall - -=head2 JoystickClose - -=head1 AUTHOR - -David J. Goehrig - -=head1 CONTRIBUTORS - -David J. Goehrig, Wayne Keenan, Guillaume Cottenceau - -=head1 SEE ALSO - - perl(1) SDL::App(3) SDL::Surface(3) SDL::Event(3) SDL::Rect(3) - SDL::Palette(3) SDL::Mixer(3) SDL::Cdrom(3) - -=cut - +=head2 SurfaceBy \ No newline at end of file