4 // Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
6 // ------------------------------------------------------------------------------
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 // ------------------------------------------------------------------------------
24 // Please feel free to send questions, suggestions or improvements to:
49 #include <SDL_image.h>
53 #include <SDL_mixer.h>
54 void (*mix_music_finished_cv)();
58 #include <SDL_sound.h>
69 #define TEXT_BLENDED 4
71 #define UTF8_SHADED 16
72 #define UTF8_BLENDED 32
73 #define UNICODE_SOLID 64
74 #define UNICODE_SHADED 128
75 #define UNICODE_BLENDED 256
79 #include <smpeg/smpeg.h>
81 static int sdl_perl_use_smpeg_audio = 0;
86 #include <SDL_rotozoom.h>
87 #include <SDL_gfxPrimitives.h>
88 #include <SDL_framerate.h>
89 #include <SDL_imageFilter.h>
97 #define HAVE_TLS_CONTEXT
101 #ifndef SDL_PERL_DEFINES_H
102 #define SDL_PERL_DEFINES_H
104 #ifdef HAVE_TLS_CONTEXT
105 PerlInterpreter *parent_perl = NULL;
106 extern PerlInterpreter *parent_perl;
107 #define GET_TLS_CONTEXT parent_perl = PERL_GET_CONTEXT;
108 #define ENTER_TLS_CONTEXT \
109 PerlInterpreter *current_perl = PERL_GET_CONTEXT; \
110 PERL_SET_CONTEXT(parent_perl); { \
111 PerlInterpreter *my_perl = parent_perl;
112 #define LEAVE_TLS_CONTEXT \
113 } PERL_SET_CONTEXT(current_perl);
115 #define GET_TLS_CONTEXT /* TLS context not enabled */
116 #define ENTER_TLS_CONTEXT /* TLS context not enabled */
117 #define LEAVE_TLS_CONTEXT /* TLS context not enabled */
123 sdl_perl_timer_callback ( Uint32 interval, void* param )
136 XPUSHs(sv_2mortal(newSViv(interval)));
139 if (0 != (back = call_sv(cmd,G_SCALAR))) {
141 if (back != 1 ) Perl_croak (aTHX_ "Timer Callback failed!");
144 Perl_croak(aTHX_ "Timer Callback failed!");
156 sdl_perl_audio_callback ( void* data, Uint8 *stream, int len )
167 XPUSHs(sv_2mortal(newSViv(PTR2IV(stream))));
168 XPUSHs(sv_2mortal(newSViv(len)));
171 call_sv(cmd,G_VOID|G_DISCARD);
180 #ifdef HAVE_SDL_MIXER
183 sdl_perl_music_callback ( void )
189 cmd = (SV*)Mix_GetMusicHookData();
196 call_sv(cmd,G_VOID|G_DISCARD);
206 sdl_perl_music_finished_callback ( void )
212 cmd = (SV*)mix_music_finished_cv;
213 if ( cmd == NULL ) return;
220 call_sv(cmd,G_VOID|G_DISCARD);
231 #define INIT_NS_APPLICATION
232 #define QUIT_NS_APPLICATION
236 sdl_perl_atexit (void)
243 void boot_SDL__OpenGL();
251 MODULE = SDL_perl PACKAGE = SDL
257 RETVAL = SDL_GetError();
266 RETVAL = SDL_Init(flags);
267 #ifdef HAVE_TLS_CONTEXT
268 Perl_call_atexit(PERL_GET_CONTEXT, (void*)sdl_perl_atexit,0);
270 atexit(sdl_perl_atexit);
276 InitSubSystem ( flags )
279 RETVAL = SDL_InitSubSystem(flags);
284 QuitSubSystem ( flags )
287 SDL_QuitSubSystem(flags);
299 RETVAL = SDL_WasInit(flags);
312 RETVAL = SDL_GetTicks();
317 SetTimer ( interval, callback )
319 SDL_TimerCallback callback
321 RETVAL = SDL_SetTimer(interval,callback);
326 AddTimer ( interval, callback, param )
328 SDL_NewTimerCallback callback
331 RETVAL = SDL_AddTimer(interval,callback,param);
338 RETVAL = sdl_perl_timer_callback;
343 NewTimer ( interval, cmd )
347 RETVAL = SDL_AddTimer(interval,sdl_perl_timer_callback,cmd);
355 RETVAL = SDL_RemoveTimer(id);
360 RWFromFile ( file, mode )
364 RETVAL = SDL_RWFromFile(file,mode);
369 RWFromFP ( fp, autoclose )
373 RETVAL = SDL_RWFromFP(fp,autoclose);
378 RWFromMem ( mem, size )
382 RETVAL = SDL_RWFromMem((void*)mem,size);
387 RWFromConstMem ( mem, size )
391 RETVAL = SDL_RWFromConstMem((const void*)mem,size);
398 RETVAL = SDL_AllocRW();
409 RWseek ( rw, off, whence )
414 RETVAL = SDL_RWseek(rw,off,whence);
422 RETVAL = SDL_RWtell(rw);
427 RWread ( rw, mem, size, n )
433 RETVAL = SDL_RWread(rw,mem,size,n);
438 RWwrite ( rw, mem, size, n )
444 RETVAL = SDL_RWwrite(rw,mem,size,n);
452 RETVAL = SDL_RWclose(rw);
459 RETVAL = SDL_CDNumDrives();
467 RETVAL = strdup(SDL_CDName(drive));
475 RETVAL = SDL_CDOpen(drive);
488 CDTrackType ( track )
491 RETVAL = track->type;
496 CDTrackLength ( track )
499 RETVAL = track->length;
504 CDTrackOffset ( track )
507 RETVAL = track->offset;
515 RETVAL = SDL_CDStatus(cd);
520 CDPlayTracks ( cd, start_track, ntracks, start_frame, nframes )
527 RETVAL = SDL_CDPlayTracks(cd,start_track,start_frame,ntracks,nframes);
532 CDPlay ( cd, start, length )
537 RETVAL = SDL_CDPlay(cd,start,length);
545 RETVAL = SDL_CDPause(cd);
553 RETVAL = SDL_CDResume(cd);
561 RETVAL = SDL_CDStop(cd);
569 RETVAL = SDL_CDEject(cd);
591 RETVAL = cd->numtracks;
599 RETVAL = cd->cur_track;
607 RETVAL = cd->cur_frame;
612 CDTrack ( cd, number )
616 RETVAL = (SDL_CDtrack *)(cd->track + number);
629 RETVAL = SDL_PushEvent( e );
636 RETVAL = (SDL_Event *) safemalloc (sizeof(SDL_Event));
650 RETVAL = SDL_PollEvent(e);
658 RETVAL = SDL_WaitEvent(e);
663 EventState ( type, state )
667 RETVAL = SDL_EventState(type,state);
680 SetEventType ( e, type )
690 ActiveEventGain ( e )
693 RETVAL = e->active.gain;
698 ActiveEventState ( e )
701 RETVAL = e->active.state;
709 RETVAL = e->key.state;
717 RETVAL = e->key.keysym.sym;
725 RETVAL = e->key.keysym.mod;
730 KeyEventUnicode ( e )
733 RETVAL = e->key.keysym.unicode;
738 KeyEventScanCode ( e )
741 RETVAL = e->key.keysym.scancode;
746 MouseMotionState ( e )
749 RETVAL = e->motion.state;
757 RETVAL = e->motion.x;
765 RETVAL = e->motion.y;
773 RETVAL = e->motion.xrel;
778 MouseMotionYrel ( e )
781 RETVAL = e->motion.yrel;
786 MouseButtonState ( e )
789 RETVAL = e->button.state;
797 RETVAL = e->button.button;
805 RETVAL = e->button.x;
813 RETVAL = e->button.y;
821 RETVAL = e->syswm.msg;
826 EnableUnicode ( enable )
829 RETVAL = SDL_EnableUNICODE(enable);
834 EnableKeyRepeat ( delay, interval )
838 SDL_EnableKeyRepeat(delay,interval);
843 RETVAL = SDL_GetModState();
848 SetModState ( state )
851 SDL_SetModState(state);
857 RETVAL = SDL_GetKeyName(sym);
863 Comment out for now as it does not compile
866 CreateRGBSurfaceFrom (pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask )
878 Uint32 len = pitch * height;
879 New(0,pixeldata,len,Uint8);
880 Copy(pixels,pixeldata,len,Uint8);
881 RETVAL = SDL_CreateRGBSurfaceFrom ( pixeldata, width, height,
882 depth, pitch, Rmask, Gmask, Bmask, Amask );
886 #ifdef HAVE_SDL_IMAGE
892 RETVAL = IMG_Load(fname);
899 SurfaceCopy ( surface )
903 Uint32 size = surface->pitch * surface->h;
904 New(0,pixels,size,Uint8);
905 Copy(surface->pixels,pixels,size,Uint8);
906 RETVAL = SDL_CreateRGBSurfaceFrom(pixels,surface->w,surface->h,
907 surface->format->BitsPerPixel, surface->pitch,
908 surface->format->Rmask, surface->format->Gmask,
909 surface->format->Bmask, surface->format->Amask);
914 FreeSurface ( surface )
918 Uint8* pixels = surface->pixels;
919 Uint32 flags = surface->flags;
920 SDL_FreeSurface(surface);
921 if (flags & SDL_PREALLOC)
926 SurfaceFlags ( surface )
929 RETVAL = surface->flags;
934 SurfacePalette ( surface )
937 RETVAL = surface->format->palette;
942 SurfaceBitsPerPixel ( surface )
945 RETVAL = surface->format->BitsPerPixel;
950 SurfaceBytesPerPixel ( surface )
953 RETVAL = surface->format->BytesPerPixel;
958 SurfaceRshift ( surface )
961 RETVAL = surface->format->Rshift;
966 SurfaceGshift ( surface )
969 RETVAL = surface->format->Gshift;
974 SurfaceBshift ( surface )
977 RETVAL = surface->format->Bshift;
982 SurfaceAshift ( surface )
985 RETVAL = surface->format->Ashift;
990 SurfaceRmask( surface )
993 RETVAL = surface->format->Rmask;
998 SurfaceGmask ( surface )
1001 RETVAL = surface->format->Gmask;
1006 SurfaceBmask ( surface )
1007 SDL_Surface *surface
1009 RETVAL = surface->format->Bmask;
1014 SurfaceAmask ( surface )
1015 SDL_Surface *surface
1017 RETVAL = surface->format->Amask;
1022 SurfaceColorKey ( surface )
1023 SDL_Surface *surface
1025 RETVAL = surface->format->colorkey;
1030 SurfaceAlpha( surface )
1031 SDL_Surface *surface
1033 RETVAL = surface->format->alpha;
1038 SurfaceW ( surface )
1039 SDL_Surface *surface
1041 RETVAL = surface->w;
1046 SurfaceH ( surface )
1047 SDL_Surface *surface
1049 RETVAL = surface->h;
1054 SurfacePitch ( surface )
1055 SDL_Surface *surface
1057 RETVAL = surface->pitch;
1062 SurfacePixels ( surface )
1063 SDL_Surface *surface
1065 RETVAL = newSVpvn(surface->pixels,surface->pitch*surface->h);
1073 Comment out for now as it does not compile
1076 SurfacePixel ( surface, x, y, ... )
1077 SDL_Surface *surface
1084 int bpp = surface->format->BytesPerPixel;
1085 Uint8* p = (Uint8*)surface->pixels + bpp*x + surface->pitch*y;
1086 if ( items < 3 || items > 4 )
1087 Perl_croak(aTHX_ "usage: SDL::SurfacePixel(surface,x,y,[color])");
1089 color = (SDL_Color*)SvIV(ST(3));
1090 pix = SDL_MapRGB(surface->format,color->r,color->g,color->b);
1099 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
1100 p[0] = (pix >> 16) & 0xff;
1101 p[1] = (pix >> 8) & 0xff;
1105 p[1] = (pix >> 8) & 0xff;
1106 p[2] = (pix >> 16) & 0xff;
1114 RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color));
1118 memcpy(RETVAL,&surface->format->palette[index],sizeof(SDL_Color));
1122 SDL_GetRGB(pix,surface->format,&r,&g,&b);
1130 SDL_GetRGB(pix,surface->format,&r,&g,&b);
1140 MUSTLOCK ( surface )
1141 SDL_Surface *surface
1143 RETVAL = SDL_MUSTLOCK(surface);
1148 SurfaceLock ( surface )
1149 SDL_Surface *surface
1151 RETVAL = SDL_LockSurface(surface);
1156 SurfaceUnlock ( surface )
1157 SDL_Surface *surface
1159 SDL_UnlockSurface(surface);
1164 RETVAL = SDL_GetVideoSurface();
1174 SDL_VideoInfo *info;
1175 info = (SDL_VideoInfo *) safemalloc ( sizeof(SDL_VideoInfo));
1176 memcpy(info,SDL_GetVideoInfo(),sizeof(SDL_VideoInfo));
1178 hv_store(hv,"hw_available",strlen("hw_available"),
1179 newSViv(info->hw_available),0);
1180 hv_store(hv,"wm_available",strlen("wm_available"),
1181 newSViv(info->wm_available),0);
1182 hv_store(hv,"blit_hw",strlen("blit_hw"),
1183 newSViv(info->blit_hw),0);
1184 hv_store(hv,"blit_hw_CC",strlen("blit_hw_CC"),
1185 newSViv(info->blit_hw_CC),0);
1186 hv_store(hv,"blit_hw_A",strlen("blit_hw_A"),
1187 newSViv(info->blit_hw_A),0);
1188 hv_store(hv,"blit_sw",strlen("blit_sw"),
1189 newSViv(info->blit_sw),0);
1190 hv_store(hv,"blit_sw_CC",strlen("blit_sw_CC"),
1191 newSViv(info->blit_sw_CC),0);
1192 hv_store(hv,"blit_sw_A",strlen("blit_sw_A"),
1193 newSViv(info->blit_sw_A),0);
1194 hv_store(hv,"blit_fill",strlen("blit_fill"),
1195 newSViv(info->blit_fill),0);
1196 hv_store(hv,"video_mem",strlen("video_mem"),
1197 newSViv(info->video_mem),0);
1203 ListModes ( format, flags )
1205 SDL_PixelFormat *format
1209 mode = SDL_ListModes(format,flags);
1210 if (mode == (SDL_Rect**)-1 ) {
1211 av_push(RETVAL,newSVpv("all",0));
1212 } else if (! mode ) {
1213 av_push(RETVAL,newSVpv("none",0));
1215 for (;*mode;mode++) {
1216 av_push(RETVAL,newSViv(PTR2IV(*mode)));
1223 NewPalette ( number )
1226 RETVAL = (SDL_Palette *)safemalloc(sizeof(SDL_Palette));
1227 RETVAL->colors = (SDL_Color *)safemalloc(number *
1229 RETVAL->ncolors = number;
1234 PaletteNColors ( palette, ... )
1235 SDL_Palette *palette
1237 if ( items > 1 ) palette->ncolors = SvIV(ST(1));
1238 RETVAL = palette->ncolors;
1243 SetVideoMode ( CLASS, width, height, bpp, flags )
1251 RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
1257 SDL_Surface *surface
1259 RETVAL = SDL_Flip(surface);
1266 Comment out for now as it does not compile
1269 PaletteColors ( palette, index, ... )
1270 SDL_Palette *palette
1274 palette->colors[index].r = SvUV(ST(2));
1275 palette->colors[index].g = SvUV(ST(3));
1276 palette->colors[index].b = SvUV(ST(4));
1278 RETVAL = (SDL_Color *)(palette->colors + index);
1285 VideoModeOK ( width, height, bpp, flags )
1291 RETVAL = SDL_VideoModeOK(width,height,bpp,flags);
1296 SetVideoMode ( width, height, bpp, flags )
1302 RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
1307 UpdateRect ( surface, x, y, w ,h )
1308 SDL_Surface *surface
1314 SDL_UpdateRect(surface,x,y,w,h);
1317 UpdateRects ( surface, ... )
1318 SDL_Surface *surface
1320 SDL_Rect *rects, *temp;
1322 if ( items < 2 ) return;
1323 num_rects = items - 1;
1324 SDL_UpdateRects(surface,num_rects,rects);
1325 rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
1326 for(i=0;i<num_rects;i++) {
1327 temp = (SDL_Rect *)SvIV(ST(i+1));
1328 rects[i].x = temp->x;
1329 rects[i].y = temp->y;
1330 rects[i].w = temp->w;
1331 rects[i].h = temp->h;
1333 SDL_UpdateRects(surface,num_rects,rects);
1338 SDL_Surface *surface
1340 RETVAL = SDL_Flip(surface);
1345 SetColors ( surface, start, ... )
1346 SDL_Surface *surface
1349 SDL_Color *colors,*temp;
1351 if ( items < 3 ) { RETVAL = 0; goto all_done; }
1353 colors = (SDL_Color *)safemalloc(sizeof(SDL_Color)*(length+1));
1354 for ( i = 0; i < length ; i++ ) {
1355 temp = (SDL_Color *)SvIV(ST(i+2));
1356 colors[i].r = temp->r;
1357 colors[i].g = temp->g;
1358 colors[i].b = temp->b;
1360 RETVAL = SDL_SetColors(surface, colors, start, length );
1367 MapRGB ( surface, r, g, b )
1368 SDL_Surface *surface
1373 RETVAL = SDL_MapRGB(surface->format,r,g,b);
1378 MapRGBA ( surface, r, g, b, a )
1379 SDL_Surface *surface
1385 RETVAL = SDL_MapRGBA(surface->format,r,g,b,a);
1390 GetRGB ( surface, pixel )
1391 SDL_Surface *surface
1395 SDL_GetRGB(pixel,surface->format,&r,&g,&b);
1397 av_push(RETVAL,newSViv(r));
1398 av_push(RETVAL,newSViv(g));
1399 av_push(RETVAL,newSViv(b));
1404 GetRGBA ( surface, pixel )
1405 SDL_Surface *surface
1409 SDL_GetRGBA(pixel,surface->format,&r,&g,&b,&a);
1411 av_push(RETVAL,newSViv(r));
1412 av_push(RETVAL,newSViv(g));
1413 av_push(RETVAL,newSViv(b));
1414 av_push(RETVAL,newSViv(a));
1419 SaveBMP ( surface, filename )
1420 SDL_Surface *surface
1423 RETVAL = SDL_SaveBMP(surface,filename);
1428 SetColorKey ( surface, flag, key )
1429 SDL_Surface *surface
1433 Uint32 pixel = SDL_MapRGB(surface->format,key->r,key->g,key->b);
1434 RETVAL = SDL_SetColorKey(surface,flag,pixel);
1439 SetAlpha ( surface, flag, alpha )
1440 SDL_Surface *surface
1444 RETVAL = SDL_SetAlpha(surface,flag,alpha);
1449 DisplayFormat ( surface )
1450 SDL_Surface *surface
1452 RETVAL = SDL_DisplayFormat(surface);
1457 DisplayFormatAlpha ( surface )
1458 SDL_Surface *surface
1460 RETVAL = SDL_DisplayFormatAlpha(surface);
1465 ConvertRGB ( surface )
1466 SDL_Surface * surface
1468 SDL_PixelFormat fmt;
1470 fmt.BitsPerPixel = 24;
1471 fmt.BytesPerPixel = 3;
1472 fmt.Rmask = 0x000000ff;
1473 fmt.Gmask = 0x0000ff00;
1474 fmt.Bmask = 0x00ff0000;
1475 fmt.Amask = 0x00000000;
1486 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1491 ConvertRGBA ( surface )
1492 SDL_Surface * surface
1494 SDL_PixelFormat fmt;
1496 fmt.BitsPerPixel = 32;
1497 fmt.BytesPerPixel = 4;
1498 fmt.Rmask = 0x000000ff;
1499 fmt.Gmask = 0x0000ff00;
1500 fmt.Bmask = 0x00ff0000;
1501 fmt.Amask = 0xff000000;
1512 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1517 BlitSurface ( src, src_rect, dest, dest_rect )
1526 RETVAL = SDL_BlitSurface(src,src_rect,dest,dest_rect);
1533 FillRect ( dest, dest_rect, color )
1541 Uint32 pixel = SDL_MapRGB(dest->format,color->r,color->g,color->b);
1542 RETVAL = SDL_FillRect(dest,dest_rect,pixel);
1549 RETVAL = SDL_GetAppState();
1555 WMSetCaption ( title, icon )
1559 SDL_WM_SetCaption(title,icon);
1565 SDL_WM_GetCaption(&title,&icon);
1567 av_push(RETVAL,newSVpv(title,0));
1568 av_push(RETVAL,newSVpv(icon,0));
1576 SDL_WM_SetIcon(icon,NULL);
1591 mask = SDL_GetMouseState(&x,&y);
1593 av_push(RETVAL,newSViv(mask));
1594 av_push(RETVAL,newSViv(x));
1595 av_push(RETVAL,newSViv(y));
1600 GetRelativeMouseState ()
1605 mask = SDL_GetRelativeMouseState(&x,&y);
1607 av_push(RETVAL,newSViv(mask));
1608 av_push(RETVAL,newSViv(x));
1609 av_push(RETVAL,newSViv(y));
1614 NewCursor ( data, mask, x ,y )
1620 RETVAL = SDL_CreateCursor((Uint8*)data->pixels,
1621 (Uint8*)mask->pixels,data->w,data->h,x,y);
1626 FreeCursor ( cursor )
1629 SDL_FreeCursor(cursor);
1632 SetCursor ( cursor )
1635 SDL_SetCursor(cursor);
1640 RETVAL = SDL_GetCursor();
1645 ShowCursor ( toggle )
1648 RETVAL = SDL_ShowCursor(toggle);
1653 NewAudioSpec ( freq, format, channels, samples )
1659 RETVAL = (SDL_AudioSpec *)safemalloc(sizeof(SDL_AudioSpec));
1660 RETVAL->freq = freq;
1661 RETVAL->format = format;
1662 RETVAL->channels = channels;
1663 RETVAL->samples = samples;
1668 FreeAudioSpec ( spec )
1674 NewAudioCVT ( src_format, src_channels, src_rate, dst_format, dst_channels, dst_rate)
1682 RETVAL = (SDL_AudioCVT *)safemalloc(sizeof(SDL_AudioCVT));
1683 if (SDL_BuildAudioCVT(RETVAL,src_format, src_channels, src_rate,
1684 dst_format, dst_channels, dst_rate)) {
1685 safefree(RETVAL); RETVAL = NULL; }
1690 FreeAudioCVT ( cvt )
1696 ConvertAudioData ( cvt, data, len )
1702 cvt->buf = (Uint8*) safemalloc(cvt->len*cvt->len_mult);
1703 memcpy(cvt->buf,data,cvt->len);
1704 RETVAL = SDL_ConvertAudio(cvt);
1709 OpenAudio ( spec, callback )
1713 spec->userdata = (void*)callback;
1714 spec->callback = sdl_perl_audio_callback;
1715 RETVAL = SDL_OpenAudio(spec,NULL);
1722 RETVAL = SDL_GetAudioStatus ();
1730 SDL_PauseAudio(p_on);
1754 LoadWAV ( filename, spec )
1758 SDL_AudioSpec *temp;
1763 temp = SDL_LoadWAV(filename,spec,&buf,&len);
1764 if ( ! temp ) goto error;
1765 av_push(RETVAL,newSViv(PTR2IV(temp)));
1766 av_push(RETVAL,newSViv(PTR2IV(buf)));
1767 av_push(RETVAL,newSViv(len));
1772 #ifdef HAVE_SDL_MIXER
1775 MixAudio ( dst, src, len, volume )
1781 SDL_MixAudio(dst,src,len,volume);
1784 MixOpenAudio ( frequency, format, channels, chunksize )
1790 RETVAL = Mix_OpenAudio(frequency, format, channels, chunksize);
1795 MixAllocateChannels ( number )
1798 RETVAL = Mix_AllocateChannels(number);
1805 int freq, channels, status;
1807 status = Mix_QuerySpec(&freq,&format,&channels);
1809 av_push(RETVAL,newSViv(status));
1810 av_push(RETVAL,newSViv(freq));
1811 av_push(RETVAL,newSViv(format));
1812 av_push(RETVAL,newSViv(channels));
1817 MixLoadWAV ( filename )
1820 RETVAL = Mix_LoadWAV(filename);
1825 MixLoadMusic ( filename )
1828 RETVAL = Mix_LoadMUS(filename);
1833 MixQuickLoadWAV ( buf )
1836 RETVAL = Mix_QuickLoad_WAV(buf);
1841 MixFreeChunk( chunk )
1844 Mix_FreeChunk(chunk);
1847 MixFreeMusic ( music )
1850 Mix_FreeMusic(music);
1853 MixSetPostMixCallback ( func, arg )
1857 Mix_SetPostMix(func,arg);
1862 RETVAL = sdl_perl_music_callback;
1867 MixSetMusicHook ( func, arg )
1871 Mix_HookMusic(func,arg);
1874 MixSetMusicFinishedHook ( func )
1877 mix_music_finished_cv = func;
1878 Mix_HookMusicFinished(sdl_perl_music_finished_callback);
1881 MixGetMusicHookData ()
1883 RETVAL = Mix_GetMusicHookData();
1888 MixReverseChannels ( number )
1891 RETVAL = Mix_ReserveChannels ( number );
1896 MixGroupChannel ( which, tag )
1900 RETVAL = Mix_GroupChannel(which,tag);
1905 MixGroupChannels ( from, to, tag )
1910 RETVAL = Mix_GroupChannels(from,to,tag);
1915 MixGroupAvailable ( tag )
1918 RETVAL = Mix_GroupAvailable(tag);
1923 MixGroupCount ( tag )
1926 RETVAL = Mix_GroupCount(tag);
1931 MixGroupOldest ( tag )
1934 RETVAL = Mix_GroupOldest(tag);
1939 MixGroupNewer ( tag )
1942 RETVAL = Mix_GroupNewer(tag);
1947 MixPlayChannel ( channel, chunk, loops )
1952 RETVAL = Mix_PlayChannel(channel,chunk,loops);
1957 MixPlayChannelTimed ( channel, chunk, loops, ticks )
1963 RETVAL = Mix_PlayChannelTimed(channel,chunk,loops,ticks);
1968 MixPlayMusic ( music, loops )
1972 RETVAL = Mix_PlayMusic(music,loops);
1977 MixFadeInChannel ( channel, chunk, loops, ms )
1983 RETVAL = Mix_FadeInChannel(channel,chunk,loops,ms);
1988 MixFadeInChannelTimed ( channel, chunk, loops, ms, ticks )
1995 RETVAL = Mix_FadeInChannelTimed(channel,chunk,loops,ms,ticks);
2000 MixFadeInMusic ( music, loops, ms )
2005 RETVAL = Mix_FadeInMusic(music,loops,ms);
2010 MixVolume ( channel, volume )
2014 RETVAL = Mix_Volume(channel,volume);
2019 MixVolumeChunk ( chunk, volume )
2023 RETVAL = Mix_VolumeChunk(chunk,volume);
2028 MixVolumeMusic ( volume )
2031 RETVAL = Mix_VolumeMusic(volume);
2036 MixHaltChannel ( channel )
2039 RETVAL = Mix_HaltChannel(channel);
2044 MixHaltGroup ( tag )
2047 RETVAL = Mix_HaltGroup(tag);
2054 RETVAL = Mix_HaltMusic();
2059 MixExpireChannel ( channel, ticks )
2063 RETVAL = Mix_ExpireChannel ( channel,ticks);
2068 MixFadeOutChannel ( which, ms )
2072 RETVAL = Mix_FadeOutChannel(which,ms);
2077 MixFadeOutGroup ( which, ms )
2081 RETVAL = Mix_FadeOutGroup(which,ms);
2086 MixFadeOutMusic ( ms )
2089 RETVAL = Mix_FadeOutMusic(ms);
2096 RETVAL = Mix_FadingMusic();
2101 MixFadingChannel( which )
2104 RETVAL = Mix_FadingChannel(which);
2109 MixPause ( channel )
2115 MixResume ( channel )
2118 Mix_Resume(channel);
2121 MixPaused ( channel )
2124 RETVAL = Mix_Paused(channel);
2146 RETVAL = Mix_PausedMusic();
2151 MixPlaying( channel )
2154 RETVAL = Mix_Playing(channel);
2161 RETVAL = Mix_PlayingMusic();
2166 MixSetPanning ( channel, left, right )
2171 RETVAL = Mix_SetPanning(channel, left, right);
2183 GLLoadLibrary ( path )
2186 RETVAL = SDL_GL_LoadLibrary(path);
2191 GLGetProcAddress ( proc )
2194 RETVAL = SDL_GL_GetProcAddress(proc);
2199 GLSetAttribute ( attr, value )
2203 RETVAL = SDL_GL_SetAttribute(attr, value);
2208 GLGetAttribute ( attr )
2213 av_push(RETVAL,newSViv(SDL_GL_GetAttribute(attr, &value)));
2214 av_push(RETVAL,newSViv(value));
2221 SDL_GL_SwapBuffers ();
2227 RETVAL = (SDL_BYTEORDER == SDL_BIG_ENDIAN);
2234 RETVAL = SDL_NumJoysticks();
2239 JoystickName ( index )
2242 RETVAL = (char*)SDL_JoystickName(index);
2247 JoystickOpen ( index )
2250 RETVAL = SDL_JoystickOpen(index);
2255 JoystickOpened ( index )
2258 RETVAL = SDL_JoystickOpened(index);
2263 JoystickIndex ( joystick )
2264 SDL_Joystick *joystick
2266 RETVAL = SDL_JoystickIndex(joystick);
2271 JoystickNumAxes ( joystick )
2272 SDL_Joystick *joystick
2274 RETVAL = SDL_JoystickNumAxes(joystick);
2279 JoystickNumBalls ( joystick )
2280 SDL_Joystick *joystick
2282 RETVAL = SDL_JoystickNumBalls(joystick);
2287 JoystickNumHats ( joystick )
2288 SDL_Joystick *joystick
2290 RETVAL = SDL_JoystickNumHats(joystick);
2295 JoystickNumButtons ( joystick )
2296 SDL_Joystick *joystick
2298 RETVAL = SDL_JoystickNumButtons(joystick);
2305 SDL_JoystickUpdate();
2308 JoystickGetAxis ( joystick, axis )
2309 SDL_Joystick *joystick
2312 RETVAL = SDL_JoystickGetAxis(joystick,axis);
2317 JoystickGetHat ( joystick, hat )
2318 SDL_Joystick *joystick
2321 RETVAL = SDL_JoystickGetHat(joystick,hat);
2326 JoystickGetButton ( joystick, button)
2327 SDL_Joystick *joystick
2330 RETVAL = SDL_JoystickGetButton(joystick,button);
2335 JoystickGetBall ( joystick, ball )
2336 SDL_Joystick *joystick
2340 success = SDL_JoystickGetBall(joystick,ball,&dx,&dy);
2342 av_push(RETVAL,newSViv(success));
2343 av_push(RETVAL,newSViv(dx));
2344 av_push(RETVAL,newSViv(dy));
2349 JoystickClose ( joystick )
2350 SDL_Joystick *joystick
2352 SDL_JoystickClose(joystick);
2355 JoyAxisEventWhich ( e )
2358 RETVAL = e->jaxis.which;
2363 JoyAxisEventAxis ( e )
2366 RETVAL = e->jaxis.axis;
2371 JoyAxisEventValue ( e )
2374 RETVAL = e->jaxis.value;
2379 JoyButtonEventWhich ( e )
2382 RETVAL = e->jbutton.which;
2387 JoyButtonEventButton ( e )
2390 RETVAL = e->jbutton.button;
2395 JoyButtonEventState ( e )
2398 RETVAL = e->jbutton.state;
2403 JoyHatEventWhich ( e )
2406 RETVAL = e->jhat.which;
2411 JoyHatEventHat ( e )
2414 RETVAL = e->jhat.hat;
2419 JoyHatEventValue ( e )
2422 RETVAL = e->jhat.value;
2427 JoyBallEventWhich ( e )
2430 RETVAL = e->jball.which;
2435 JoyBallEventBall ( e )
2438 RETVAL = e->jball.ball;
2443 JoyBallEventXrel ( e )
2446 RETVAL = e->jball.xrel;
2451 JoyBallEventYrel ( e )
2454 RETVAL = e->jball.yrel;
2459 SetClipRect ( surface, rect )
2460 SDL_Surface *surface
2463 SDL_SetClipRect(surface,rect);
2466 GetClipRect ( surface, rect )
2467 SDL_Surface *surface
2470 SDL_GetClipRect(surface, rect);
2478 RETVAL = SDLNet_Init();
2488 NetNewIPaddress ( host, port )
2492 RETVAL = (IPaddress*) safemalloc(sizeof(IPaddress));
2493 RETVAL->host = host;
2494 RETVAL->port = port;
2499 NetIPaddressHost ( ip )
2507 NetIPaddressPort ( ip )
2515 NetFreeIPaddress ( ip )
2521 NetResolveIP ( address )
2524 RETVAL = SDLNet_ResolveIP(address);
2529 NetResolveHost ( address, host, port )
2534 RETVAL = SDLNet_ResolveHost(address,host,port);
2542 RETVAL = SDLNet_TCP_Open(ip);
2547 NetTCPAccept ( server )
2550 RETVAL = SDLNet_TCP_Accept(server);
2555 NetTCPGetPeerAddress ( sock )
2558 RETVAL = SDLNet_TCP_GetPeerAddress(sock);
2563 NetTCPSend ( sock, data, len )
2568 RETVAL = SDLNet_TCP_Send(sock,data,len);
2573 NetTCPRecv ( sock, maxlen )
2579 buffer = safemalloc(maxlen);
2581 status = SDLNet_TCP_Recv(sock,buffer,maxlen);
2582 av_push(RETVAL,newSViv(status));
2583 av_push(RETVAL,newSVpvn((char*)buffer,maxlen));
2588 NetTCPClose ( sock )
2591 SDLNet_TCP_Close(sock);
2594 NetAllocPacket ( size )
2597 RETVAL = SDLNet_AllocPacket(size);
2602 NetAllocPacketV ( howmany, size )
2606 RETVAL = SDLNet_AllocPacketV(howmany,size);
2611 NetResizePacket ( packet, newsize )
2615 RETVAL = SDLNet_ResizePacket(packet,newsize);
2620 NetFreePacket ( packet )
2623 SDLNet_FreePacket(packet);
2626 NetFreePacketV ( packet )
2629 SDLNet_FreePacketV(packet);
2635 RETVAL = SDLNet_UDP_Open(port);
2640 NetUDPBind ( sock, channel, address )
2645 RETVAL = SDLNet_UDP_Bind(sock,channel,address);
2650 NetUDPUnbind ( sock, channel )
2654 SDLNet_UDP_Unbind(sock,channel);
2657 NetUDPGetPeerAddress ( sock, channel )
2661 RETVAL = SDLNet_UDP_GetPeerAddress(sock,channel);
2666 NetUDPSendV ( sock, packets, npackets )
2671 RETVAL = SDLNet_UDP_SendV(sock,packets,npackets);
2676 NetUDPSend ( sock, channel, packet )
2681 RETVAL = SDLNet_UDP_Send(sock,channel,packet);
2686 NetUDPRecvV ( sock, packets )
2690 RETVAL = SDLNet_UDP_RecvV(sock,packets);
2695 NetUDPRecv ( sock, packet )
2699 RETVAL = SDLNet_UDP_Recv(sock,packet);
2704 NetUDPClose ( sock )
2707 SDLNet_UDP_Close(sock);
2710 NetAllocSocketSet ( maxsockets )
2713 RETVAL = SDLNet_AllocSocketSet(maxsockets);
2718 NetTCP_AddSocket ( set, sock )
2719 SDLNet_SocketSet set
2722 RETVAL = SDLNet_TCP_AddSocket(set,sock);
2727 NetUDP_AddSocket ( set, sock )
2728 SDLNet_SocketSet set
2731 RETVAL = SDLNet_UDP_AddSocket(set,sock);
2736 NetTCP_DelSocket ( set, sock )
2737 SDLNet_SocketSet set
2740 RETVAL = SDLNet_TCP_DelSocket(set,sock);
2745 NetUDP_DelSocket ( set, sock )
2746 SDLNet_SocketSet set
2749 RETVAL = SDLNet_UDP_DelSocket(set,sock);
2754 NetCheckSockets ( set, timeout )
2755 SDLNet_SocketSet set
2758 RETVAL = SDLNet_CheckSockets(set,timeout);
2763 NetSocketReady ( sock )
2764 SDLNet_GenericSocket sock
2766 RETVAL = SDLNet_SocketReady(sock);
2771 NetFreeSocketSet ( set )
2772 SDLNet_SocketSet set
2774 SDLNet_FreeSocketSet(set);
2777 NetWrite16 ( value, area )
2781 SDLNet_Write16(value,area);
2784 NetWrite32 ( value, area )
2788 SDLNet_Write32(value,area);
2794 RETVAL = SDLNet_Read16(area);
2802 RETVAL = SDLNet_Read32(area);
2813 RETVAL = TTF_Init();
2823 TTFOpenFont ( file, ptsize )
2827 RETVAL = TTF_OpenFont(file,ptsize);
2832 TTFGetFontStyle ( font )
2835 RETVAL = TTF_GetFontStyle(font);
2840 TTFSetFontStyle ( font, style )
2844 TTF_SetFontStyle(font,style);
2847 TTFFontHeight ( font )
2850 RETVAL = TTF_FontHeight(font);
2855 TTFFontAscent ( font )
2858 RETVAL = TTF_FontAscent(font);
2863 TTFFontDescent ( font )
2866 RETVAL = TTF_FontDescent(font);
2871 TTFFontLineSkip ( font )
2874 RETVAL = TTF_FontLineSkip(font);
2879 TTFGlyphMetrics ( font, ch )
2883 int minx, miny, maxx, maxy, advance;
2885 TTF_GlyphMetrics(font, ch, &minx, &miny, &maxx, &maxy, &advance);
2886 av_push(RETVAL,newSViv(minx));
2887 av_push(RETVAL,newSViv(miny));
2888 av_push(RETVAL,newSViv(maxx));
2889 av_push(RETVAL,newSViv(maxy));
2890 av_push(RETVAL,newSViv(advance));
2895 TTFSizeText ( font, text )
2901 if(TTF_SizeText(font,text,&w,&h))
2903 printf("TTF error at TTFSizeText: %s \n", TTF_GetError());
2904 Perl_croak (aTHX_ "TTF error \n");
2908 av_push(RETVAL,newSViv(w));
2909 av_push(RETVAL,newSViv(h));
2910 sv_2mortal((SV*)RETVAL);
2918 TTFSizeUTF8 ( font, text )
2924 if(TTF_SizeUTF8(font,text,&w,&h))
2926 av_push(RETVAL,newSViv(w));
2927 av_push(RETVAL,newSViv(h));
2928 sv_2mortal((SV*)RETVAL);
2933 printf("TTF error at TTFSizeUTF8 with : %s \n", TTF_GetError());
2934 Perl_croak (aTHX_ "TTF error \n");
2941 TTFSizeUNICODE ( font, text )
2947 if(TTF_SizeUNICODE(font,text,&w,&h))
2949 av_push(RETVAL,newSViv(w));
2950 av_push(RETVAL,newSViv(h));
2951 sv_2mortal((SV*)RETVAL);
2956 printf("TTF error at TTFSizeUNICODE : %s \n", TTF_GetError());
2957 Perl_croak (aTHX_ "TTF error \n");
2966 TTFRenderTextSolid ( font, text, fg )
2971 RETVAL = TTF_RenderText_Solid(font,text,*fg);
2976 TTFRenderUTF8Solid ( font, text, fg )
2981 RETVAL = TTF_RenderUTF8_Solid(font,text,*fg);
2986 TTFRenderUNICODESolid ( font, text, fg )
2991 RETVAL = TTF_RenderUNICODE_Solid(font,text,*fg);
2996 TTFRenderGlyphSolid ( font, ch, fg )
3001 RETVAL = TTF_RenderGlyph_Solid(font,ch,*fg);
3006 TTFRenderTextShaded ( font, text, fg, bg )
3012 RETVAL = TTF_RenderText_Shaded(font,text,*fg,*bg);
3017 TTFRenderUTF8Shaded( font, text, fg, bg )
3023 RETVAL = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3028 TTFRenderUNICODEShaded( font, text, fg, bg )
3034 RETVAL = TTF_RenderUNICODE_Shaded(font,text,*fg,*bg);
3039 TTFRenderGlyphShaded ( font, ch, fg, bg )
3045 RETVAL = TTF_RenderGlyph_Shaded(font,ch,*fg,*bg);
3050 TTFRenderTextBlended( font, text, fg )
3055 RETVAL = TTF_RenderText_Blended(font,text,*fg);
3060 TTFRenderUTF8Blended( font, text, fg )
3065 RETVAL = TTF_RenderUTF8_Blended(font,text,*fg);
3070 TTFRenderUNICODEBlended( font, text, fg )
3075 RETVAL = TTF_RenderUNICODE_Blended(font,text,*fg);
3080 TTFRenderGlyphBlended( font, ch, fg )
3085 RETVAL = TTF_RenderGlyph_Blended(font,ch,*fg);
3090 TTFCloseFont ( font )
3093 TTF_CloseFont(font);
3094 font=NULL; //to be safe http://sdl.beuc.net/sdl.wiki/SDL_ttf_copy_Functions_Management_TTF_CloseFont
3097 TTFPutString ( font, mode, surface, x, y, fg, bg, text )
3100 SDL_Surface *surface
3115 img = TTF_RenderText_Solid(font,text,*fg);
3116 TTF_SizeText(font,text,&w,&h);
3121 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3122 TTF_SizeText(font,text,&w,&h);
3127 img = TTF_RenderText_Blended(font,text,*fg);
3128 TTF_SizeText(font,text,&w,&h);
3133 img = TTF_RenderUTF8_Solid(font,text,*fg);
3134 TTF_SizeUTF8(font,text,&w,&h);
3139 img = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3140 TTF_SizeUTF8(font,text,&w,&h);
3145 img = TTF_RenderUTF8_Blended(font,text,*fg);
3146 TTF_SizeUTF8(font,text,&w,&h);
3151 img = TTF_RenderUNICODE_Solid(font,(Uint16*)text,*fg);
3152 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3156 case UNICODE_SHADED:
3157 img = TTF_RenderUNICODE_Shaded(font,(Uint16*)text,*fg,*bg);
3158 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3162 case UNICODE_BLENDED:
3163 img = TTF_RenderUNICODE_Blended(font,(Uint16*)text,*fg);
3164 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3169 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3170 TTF_SizeText(font,text,&w,&h);
3174 if ( img && img->format && img->format->palette ) {
3175 SDL_Color *c = &img->format->palette->colors[0];
3176 Uint32 key = SDL_MapRGB( img->format, c->r, c->g, c->b );
3177 SDL_SetColorKey(img,SDL_SRCCOLORKEY,key );
3178 if (0 > SDL_BlitSurface(img,NULL,surface,&dest)) {
3179 SDL_FreeSurface(img);
3193 CreateYUVOverlay ( width, height, format, display )
3197 SDL_Surface *display
3199 RETVAL = SDL_CreateYUVOverlay ( width, height, format, display );
3204 LockYUVOverlay ( overlay )
3205 SDL_Overlay *overlay
3207 RETVAL = SDL_LockYUVOverlay(overlay);
3212 UnlockYUVOverlay ( overlay )
3213 SDL_Overlay *overlay
3215 SDL_UnlockYUVOverlay(overlay);
3218 DisplayYUVOverlay ( overlay, dstrect )
3219 SDL_Overlay *overlay
3222 RETVAL = SDL_DisplayYUVOverlay ( overlay, dstrect );
3227 FreeYUVOverlay ( overlay )
3228 SDL_Overlay *overlay
3230 SDL_FreeYUVOverlay ( overlay );
3233 OverlayFormat ( overlay, ... )
3234 SDL_Overlay *overlay
3237 overlay->format = SvIV(ST(1));
3238 RETVAL = overlay->format;
3243 OverlayW ( overlay, ... )
3244 SDL_Overlay *overlay
3247 overlay->w = SvIV(ST(1));
3248 RETVAL = overlay->w;
3253 OverlayH ( overlay, ... )
3254 SDL_Overlay *overlay
3257 overlay->h = SvIV(ST(1));
3258 RETVAL = overlay->h;
3263 OverlayPlanes ( overlay, ... )
3264 SDL_Overlay *overlay
3267 overlay->planes = SvIV(ST(1));
3268 RETVAL = overlay->planes;
3273 OverlayHW ( overlay )
3274 SDL_Overlay *overlay
3276 RETVAL = overlay->hw_overlay;
3281 OverlayPitches ( overlay )
3282 SDL_Overlay *overlay
3284 RETVAL = overlay->pitches;
3289 OverlayPixels ( overlay )
3290 SDL_Overlay *overlay
3292 RETVAL = overlay->pixels;
3297 WMToggleFullScreen ( surface )
3298 SDL_Surface *surface
3300 RETVAL = SDL_WM_ToggleFullScreen(surface);
3305 WMGrabInput ( mode )
3308 RETVAL = SDL_WM_GrabInput(mode);
3315 RETVAL = SDL_WM_IconifyWindow();
3323 RETVAL = e->resize.w;
3331 RETVAL = e->resize.h;
3339 RETVAL = SDL_AudioDriverName(name,32);
3347 if (k >= SDLK_LAST) Perl_croak (aTHX_ "Key out of range");
3348 RETVAL = SDL_GetKeyState(NULL)[k];
3357 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3362 FreeSMPEGInfo ( info )
3368 SMPEGInfoHasAudio ( info )
3371 RETVAL = info->has_audio;
3376 SMPEGInfoHasVideo ( info )
3379 RETVAL = info->has_video;
3384 SMPEGInfoWidth ( info )
3387 RETVAL = info->width;
3392 SMPEGInfoHeight ( info )
3395 RETVAL = info->height;
3400 SMPEGInfoCurrentFrame ( info )
3403 RETVAL = info->current_frame;
3408 SMPEGInfoCurrentFPS ( info )
3411 RETVAL = info->current_fps;
3416 SMPEGInfoCurrentAudioFrame ( info )
3419 RETVAL = info->audio_current_frame;
3424 SMPEGInfoCurrentOffset ( info )
3427 RETVAL = info->current_offset;
3432 SMPEGInfoTotalSize ( info )
3435 RETVAL = info->total_size;
3440 SMPEGInfoCurrentTime ( info )
3443 RETVAL = info->current_time;
3448 SMPEGInfoTotalTime ( info )
3451 RETVAL = info->total_time;
3459 RETVAL = SMPEG_error(mpeg);
3464 NewSMPEG ( filename, info, use_audio )
3469 #ifdef HAVE_SDL_MIXER
3470 RETVAL = SMPEG_new(filename,info,0);
3472 RETVAL = SMPEG_new(filename,info,use_audio);
3484 SMPEGEnableAudio ( mpeg , flag )
3488 SMPEG_enableaudio(mpeg,flag);
3489 #ifdef HAVE_SDL_MIXER
3490 sdl_perl_use_smpeg_audio = flag;
3494 SMPEGEnableVideo ( mpeg , flag )
3498 SMPEG_enablevideo(mpeg,flag);
3501 SMPEGSetVolume ( mpeg , volume )
3505 SMPEG_setvolume(mpeg,volume);
3508 SMPEGSetDisplay ( mpeg, dest, surfLock )
3513 SMPEG_setdisplay(mpeg,dest,surfLock,NULL);
3516 SMPEGScaleXY ( mpeg, w, h)
3521 SMPEG_scaleXY(mpeg,w,h);
3524 SMPEGScale ( mpeg, scale )
3528 SMPEG_scale(mpeg,scale);
3534 SDL_AudioSpec audiofmt;
3537 #ifdef HAVE_SDL_MIXER
3538 if (sdl_perl_use_smpeg_audio ) {
3539 SMPEG_enableaudio(mpeg, 0);
3540 Mix_QuerySpec(&freq, &format, &channels);
3541 audiofmt.format = format;
3542 audiofmt.freq = freq;
3543 audiofmt.channels = channels;
3544 SMPEG_actualSpec(mpeg, &audiofmt);
3545 Mix_HookMusic(SMPEG_playAudioSDL, mpeg);
3546 SMPEG_enableaudio(mpeg, 1);
3552 SMPEGStatus ( mpeg )
3555 RETVAL = SMPEG_status(mpeg);
3566 SMPEGLoop ( mpeg, repeat )
3570 SMPEG_loop(mpeg,repeat);
3577 #ifdef HAVE_SDL_MIXER
3578 Mix_HookMusic(NULL, NULL);
3582 SMPEGRewind ( mpeg )
3588 SMPEGSeek ( mpeg, bytes )
3592 SMPEG_seek(mpeg,bytes);
3595 SMPEGSkip ( mpeg, seconds )
3599 SMPEG_skip(mpeg,seconds);
3602 SMPEGSetDisplayRegion ( mpeg, rect )
3606 SMPEG_setdisplayregion(mpeg,rect->x,rect->y,rect->w,rect->h);
3609 SMPEGRenderFrame ( mpeg, frame )
3613 SMPEG_renderFrame(mpeg,frame);
3616 SMPEGGetInfo ( mpeg )
3619 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3620 SMPEG_getinfo(mpeg,RETVAL);
3632 GFXRotoZoom ( src, angle, zoom, smooth)
3638 RETVAL = rotozoomSurface( src, angle, zoom, smooth);
3643 GFXZoom ( src, zoomx, zoomy, smooth)
3649 RETVAL = zoomSurface( src, zoomx, zoomy, smooth);
3656 GFXPixelColor ( dst, x, y, color )
3662 RETVAL = pixelColor( dst, x, y, color);
3667 GFXPixelRGBA ( dst, x, y, r, g, b, a )
3676 RETVAL = pixelRGBA( dst, x, y, r, g, b, a );
3681 GFXHlineColor ( dst, x1, x2, y, color )
3688 RETVAL = hlineColor( dst, x1, x2, y, color );
3693 GFXHlineRGBA ( dst, x1, x2, y, r, g, b, a )
3703 RETVAL = hlineRGBA( dst, x1, x2, y, r, g, b, a );
3708 GFXVlineColor ( dst, x, y1, y2, color )
3715 RETVAL = vlineColor( dst, x, y1, y2, color );
3720 GFXVlineRGBA ( dst, x, y1, y2, r, g, b, a )
3730 RETVAL = vlineRGBA( dst, x, y1, y2, r, g, b, a );
3735 GFXRectangleColor ( dst, x1, y1, x2, y2, color )
3743 RETVAL = rectangleColor( dst, x1, y1, x2, y2, color );
3748 GFXRectangleRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3759 RETVAL = rectangleRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3764 GFXBoxColor ( dst, x1, y1, x2, y2, color )
3772 RETVAL = boxColor( dst, x1, y1, x2, y2, color );
3777 GFXBoxRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3788 RETVAL = boxRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3793 GFXLineColor ( dst, x1, y1, x2, y2, color )
3801 RETVAL = lineColor( dst, x1, y1, x2, y2, color );
3806 GFXLineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3817 RETVAL = lineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3822 GFXAalineColor ( dst, x1, y1, x2, y2, color )
3830 RETVAL = aalineColor( dst, x1, y1, x2, y2, color );
3835 GFXAalineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3846 RETVAL = aalineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3851 GFXCircleColor ( dst, x, y, r, color )
3858 RETVAL = circleColor( dst, x, y, r, color );
3863 GFXCircleRGBA ( dst, x, y, rad, r, g, b, a )
3873 RETVAL = circleRGBA( dst, x, y, rad, r, g, b, a );
3878 GFXAacircleColor ( dst, x, y, r, color )
3885 RETVAL = aacircleColor( dst, x, y, r, color );
3890 GFXAacircleRGBA ( dst, x, y, rad, r, g, b, a )
3900 RETVAL = aacircleRGBA( dst, x, y, rad, r, g, b, a );
3905 GFXFilledCircleColor ( dst, x, y, r, color )
3912 RETVAL = filledCircleColor( dst, x, y, r, color );
3917 GFXFilledCircleRGBA ( dst, x, y, rad, r, g, b, a )
3927 RETVAL = filledCircleRGBA( dst, x, y, rad, r, g, b, a );
3932 GFXEllipseColor ( dst, x, y, rx, ry, color )
3940 RETVAL = ellipseColor( dst, x, y, rx, ry, color );
3945 GFXEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
3956 RETVAL = ellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
3961 GFXAaellipseColor ( dst, xc, yc, rx, ry, color )
3969 RETVAL = aaellipseColor( dst, xc, yc, rx, ry, color );
3974 GFXAaellipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
3985 RETVAL = aaellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
3990 GFXFilledEllipseColor ( dst, x, y, rx, ry, color )
3998 RETVAL = filledEllipseColor( dst, x, y, rx, ry, color );
4003 GFXFilledEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
4014 RETVAL = filledEllipseRGBA( dst, x, y, rx, ry, r, g, b, a );
4019 GFXFilledPieColor ( dst, x, y, rad, start, end, color )
4028 RETVAL = filledPieColor( dst, x, y, rad, start, end, color );
4033 GFXFilledPieRGBA ( dst, x, y, rad, start, end, r, g, b, a )
4045 RETVAL = filledPieRGBA( dst, x, y, rad, start, end, r, g, b, a );
4050 GFXPolygonColor ( dst, vx, vy, n, color )
4057 RETVAL = polygonColor( dst, vx, vy, n, color );
4062 GFXPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4072 RETVAL = polygonRGBA( dst, vx, vy, n, r, g, b, a );
4077 GFXAapolygonColor ( dst, vx, vy, n, color )
4084 RETVAL = aapolygonColor( dst, vx, vy, n, color );
4089 GFXAapolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4099 RETVAL = aapolygonRGBA( dst, vx, vy, n, r, g, b, a );
4104 GFXFilledPolygonColor ( dst, vx, vy, n, color )
4111 RETVAL = filledPolygonColor( dst, vx, vy, n, color );
4116 GFXFilledPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4126 RETVAL = filledPolygonRGBA( dst, vx, vy, n, r, g, b, a );
4131 GFXCharacterColor ( dst, x, y, c, color )
4138 RETVAL = characterColor( dst, x, y, c, color );
4143 GFXCharacterRGBA ( dst, x, y, c, r, g, b, a )
4153 RETVAL = characterRGBA( dst, x, y, c, r, g, b, a );
4158 GFXStringColor ( dst, x, y, c, color )
4165 RETVAL = stringColor( dst, x, y, c, color );
4170 GFXStringRGBA ( dst, x, y, c, r, g, b, a )
4180 RETVAL = stringRGBA( dst, x, y, c, r, g, b, a );
4190 SVG_Load ( filename )
4193 RETVAL = SVG_Load(filename);
4198 SVG_LoadBuffer ( data, len )
4202 RETVAL = SVG_LoadBuffer(data,len);
4207 SVG_SetOffset ( source, xoff, yoff )
4208 SDL_svg_context* source
4212 RETVAL = SVG_SetOffset(source,xoff,yoff);
4217 SVG_SetScale ( source, xscale, yscale )
4218 SDL_svg_context* source
4222 RETVAL = SVG_SetScale(source,xscale,yscale);
4227 SVG_RenderToSurface ( source, x, y, dest )
4228 SDL_svg_context* source
4233 RETVAL = SVG_RenderToSurface(source,x,y,dest);
4239 SDL_svg_context* source
4244 SVG_Set_Flags ( source, flags )
4245 SDL_svg_context* source
4248 SVG_Set_Flags(source,flags);
4251 SVG_Width ( source )
4252 SDL_svg_context* source
4254 RETVAL = SVG_Width(source);
4259 SVG_HEIGHT ( source )
4260 SDL_svg_context* source
4262 RETVAL = SVG_Height(source);
4267 SVG_SetClipping ( source, minx, miny, maxx, maxy )
4268 SDL_svg_context* source
4274 SVG_SetClipping(source,minx,miny,maxx,maxy);
4279 RETVAL = SVG_Version();
4286 #ifdef HAVE_SDL_SOUND
4289 SoundAudioInfoFormat ( audioinfo )
4290 Sound_AudioInfo* audioinfo
4292 RETVAL = audioinfo->format;
4297 SoundAudioInfoChannels ( audioinfo )
4298 Sound_AudioInfo* audioinfo
4300 RETVAL = audioinfo->channels;
4305 SoundAudioInforate ( audioinfo )
4306 Sound_AudioInfo* audioinfo
4308 RETVAL = audioinfo->rate;
4313 SoundDecoderInfoExtensions ( decoderinfo )
4314 Sound_DecoderInfo* decoderinfo
4317 for ( ext = decoderinfo->extensions; *ext != NULL; ext++ ){
4318 av_push(RETVAL,newSVpv(*ext,0));
4324 SoundDecoderInfoDescription ( decoderinfo )
4325 Sound_DecoderInfo* decoderinfo
4327 RETVAL = decoderinfo->description;
4332 SoundDecoderInfoAuthor ( decoderinfo )
4333 Sound_DecoderInfo* decoderinfo
4335 RETVAL = decoderinfo->author;
4340 SoundDecoderInfoUrl ( decoderinfo )
4341 Sound_DecoderInfo* decoderinfo
4343 RETVAL = decoderinfo->url;
4347 const Sound_DecoderInfo*
4348 SoundSampleDecoder ( sample )
4349 Sound_Sample* sample
4351 RETVAL = sample->decoder;
4356 SoundSampleDesired ( sample )
4357 Sound_Sample* sample
4359 RETVAL = &sample->desired;
4364 SoundSampleAcutal ( sample )
4365 Sound_Sample* sample
4367 RETVAL = &sample->actual;
4372 SoundSampleBuffer ( sample )
4373 Sound_Sample* sample
4375 RETVAL = sample->buffer;
4380 SoundSampleBufferSize ( sample )
4381 Sound_Sample* sample
4383 RETVAL = sample->buffer_size;
4388 SoundSampleFlags ( sample )
4389 Sound_Sample* sample
4391 RETVAL = (Uint32)sample->flags;
4398 RETVAL = Sound_Init();
4405 RETVAL = Sound_Quit();
4410 Sound_AvailableDecoders ( )
4413 const Sound_DecoderInfo** sdi;
4414 sdi = Sound_AvailableDecoders();
4416 for (;*sdi != NULL; ++sdi) {
4417 av_push(RETVAL,sv_2mortal(newSViv(PTR2IV(*sdi))));
4426 RETVAL = Sound_GetError();
4431 Sound_ClearError ( )
4436 Sound_NewSample ( rw, ext, desired, buffsize )
4439 Sound_AudioInfo* desired
4442 RETVAL = Sound_NewSample(rw,ext,desired,buffsize);
4447 Sound_NewSampleFromMem ( data, size, ext, desired, buffsize )
4451 Sound_AudioInfo* desired
4454 RETVAL = Sound_NewSampleFromMem(data,size,ext,desired,buffsize);
4459 Sound_NewSampleFromFile ( fname, desired, buffsize )
4461 Sound_AudioInfo* desired
4464 RETVAL = Sound_NewSampleFromFile(fname,desired,buffsize);
4469 Sound_FreeSample ( sample )
4470 Sound_Sample* sample
4472 Sound_FreeSample(sample);
4475 Sound_GetDuration ( sample )
4476 Sound_Sample* sample
4478 RETVAL = Sound_GetDuration(sample);
4483 Sound_SetBufferSize ( sample, size )
4484 Sound_Sample* sample
4487 RETVAL = Sound_SetBufferSize(sample,size);
4492 Sound_Decode ( sample )
4493 Sound_Sample* sample
4495 RETVAL = Sound_Decode(sample);
4500 Sound_DecodeAll ( sample )
4501 Sound_Sample* sample
4503 RETVAL = Sound_DecodeAll(sample);
4508 Sound_Rewind ( sample )
4509 Sound_Sample* sample
4511 RETVAL = Sound_Rewind(sample);
4516 Sound_Seek ( sample, ms )
4517 Sound_Sample* sample
4520 RETVAL = Sound_Seek(sample,ms);
4526 MODULE = SDL PACKAGE = SDL
4527 PROTOTYPES : DISABLE