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
100 #include "src/defines.h"
103 sdl_perl_timer_callback ( Uint32 interval, void* param )
116 XPUSHs(sv_2mortal(newSViv(interval)));
119 if (0 != (back = call_sv(cmd,G_SCALAR))) {
121 if (back != 1 ) Perl_croak (aTHX_ "Timer Callback failed!");
124 Perl_croak(aTHX_ "Timer Callback failed!");
136 sdl_perl_audio_callback ( void* data, Uint8 *stream, int len )
147 XPUSHs(sv_2mortal(newSViv(PTR2IV(stream))));
148 XPUSHs(sv_2mortal(newSViv(len)));
151 call_sv(cmd,G_VOID|G_DISCARD);
160 #ifdef HAVE_SDL_MIXER
163 sdl_perl_music_callback ( void )
169 cmd = (SV*)Mix_GetMusicHookData();
176 call_sv(cmd,G_VOID|G_DISCARD);
186 sdl_perl_music_finished_callback ( void )
192 cmd = (SV*)mix_music_finished_cv;
193 if ( cmd == NULL ) return;
200 call_sv(cmd,G_VOID|G_DISCARD);
211 #define INIT_NS_APPLICATION
212 #define QUIT_NS_APPLICATION
216 sdl_perl_atexit (void)
223 void boot_SDL__OpenGL();
231 MODULE = SDL_perl PACKAGE = SDL
237 RETVAL = SDL_GetError();
246 RETVAL = SDL_Init(flags);
247 #ifdef HAVE_TLS_CONTEXT
248 Perl_call_atexit(PERL_GET_CONTEXT, (void*)sdl_perl_atexit,0);
250 atexit(sdl_perl_atexit);
256 InitSubSystem ( flags )
259 RETVAL = SDL_InitSubSystem(flags);
264 QuitSubSystem ( flags )
267 SDL_QuitSubSystem(flags);
279 RETVAL = SDL_WasInit(flags);
292 RETVAL = SDL_GetTicks();
297 SetTimer ( interval, callback )
299 SDL_TimerCallback callback
301 RETVAL = SDL_SetTimer(interval,callback);
306 AddTimer ( interval, callback, param )
308 SDL_NewTimerCallback callback
311 RETVAL = SDL_AddTimer(interval,callback,param);
318 RETVAL = sdl_perl_timer_callback;
323 NewTimer ( interval, cmd )
327 RETVAL = SDL_AddTimer(interval,sdl_perl_timer_callback,cmd);
335 RETVAL = SDL_RemoveTimer(id);
340 RWFromFile ( file, mode )
344 RETVAL = SDL_RWFromFile(file,mode);
349 RWFromFP ( fp, autoclose )
353 RETVAL = SDL_RWFromFP(fp,autoclose);
358 RWFromMem ( mem, size )
362 RETVAL = SDL_RWFromMem((void*)mem,size);
367 RWFromConstMem ( mem, size )
371 RETVAL = SDL_RWFromConstMem((const void*)mem,size);
378 RETVAL = SDL_AllocRW();
389 RWseek ( rw, off, whence )
394 RETVAL = SDL_RWseek(rw,off,whence);
402 RETVAL = SDL_RWtell(rw);
407 RWread ( rw, mem, size, n )
413 RETVAL = SDL_RWread(rw,mem,size,n);
418 RWwrite ( rw, mem, size, n )
424 RETVAL = SDL_RWwrite(rw,mem,size,n);
432 RETVAL = SDL_RWclose(rw);
439 RETVAL = SDL_CDNumDrives();
447 RETVAL = strdup(SDL_CDName(drive));
455 RETVAL = SDL_CDOpen(drive);
468 CDTrackType ( track )
471 RETVAL = track->type;
476 CDTrackLength ( track )
479 RETVAL = track->length;
484 CDTrackOffset ( track )
487 RETVAL = track->offset;
495 RETVAL = SDL_CDStatus(cd);
500 CDPlayTracks ( cd, start_track, ntracks, start_frame, nframes )
507 RETVAL = SDL_CDPlayTracks(cd,start_track,start_frame,ntracks,nframes);
512 CDPlay ( cd, start, length )
517 RETVAL = SDL_CDPlay(cd,start,length);
525 RETVAL = SDL_CDPause(cd);
533 RETVAL = SDL_CDResume(cd);
541 RETVAL = SDL_CDStop(cd);
549 RETVAL = SDL_CDEject(cd);
571 RETVAL = cd->numtracks;
579 RETVAL = cd->cur_track;
587 RETVAL = cd->cur_frame;
592 CDTrack ( cd, number )
596 RETVAL = (SDL_CDtrack *)(cd->track + number);
609 RETVAL = SDL_PushEvent( e );
616 RETVAL = (SDL_Event *) safemalloc (sizeof(SDL_Event));
630 RETVAL = SDL_PollEvent(e);
638 RETVAL = SDL_WaitEvent(e);
643 EventState ( type, state )
647 RETVAL = SDL_EventState(type,state);
660 SetEventType ( e, type )
670 ActiveEventGain ( e )
673 RETVAL = e->active.gain;
678 ActiveEventState ( e )
681 RETVAL = e->active.state;
689 RETVAL = e->key.state;
697 RETVAL = e->key.keysym.sym;
705 RETVAL = e->key.keysym.mod;
710 KeyEventUnicode ( e )
713 RETVAL = e->key.keysym.unicode;
718 KeyEventScanCode ( e )
721 RETVAL = e->key.keysym.scancode;
726 MouseMotionState ( e )
729 RETVAL = e->motion.state;
737 RETVAL = e->motion.x;
745 RETVAL = e->motion.y;
753 RETVAL = e->motion.xrel;
758 MouseMotionYrel ( e )
761 RETVAL = e->motion.yrel;
766 MouseButtonState ( e )
769 RETVAL = e->button.state;
777 RETVAL = e->button.button;
785 RETVAL = e->button.x;
793 RETVAL = e->button.y;
801 RETVAL = e->syswm.msg;
806 EnableUnicode ( enable )
809 RETVAL = SDL_EnableUNICODE(enable);
814 EnableKeyRepeat ( delay, interval )
818 SDL_EnableKeyRepeat(delay,interval);
823 RETVAL = SDL_GetModState();
828 SetModState ( state )
831 SDL_SetModState(state);
837 RETVAL = SDL_GetKeyName(sym);
842 CreateRGBSurface (flags, width, height, depth, Rmask, Gmask, Bmask, Amask )
852 RETVAL = SDL_CreateRGBSurface ( flags, width, height,
853 depth, Rmask, Gmask, Bmask, Amask );
859 CreateRGBSurfaceFrom (pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask )
871 Uint32 len = pitch * height;
872 New(0,pixeldata,len,Uint8);
873 Copy(pixels,pixeldata,len,Uint8);
874 RETVAL = SDL_CreateRGBSurfaceFrom ( pixeldata, width, height,
875 depth, pitch, Rmask, Gmask, Bmask, Amask );
879 #ifdef HAVE_SDL_IMAGE
885 RETVAL = IMG_Load(fname);
892 SurfaceCopy ( surface )
896 Uint32 size = surface->pitch * surface->h;
897 New(0,pixels,size,Uint8);
898 Copy(surface->pixels,pixels,size,Uint8);
899 RETVAL = SDL_CreateRGBSurfaceFrom(pixels,surface->w,surface->h,
900 surface->format->BitsPerPixel, surface->pitch,
901 surface->format->Rmask, surface->format->Gmask,
902 surface->format->Bmask, surface->format->Amask);
907 FreeSurface ( surface )
911 Uint8* pixels = surface->pixels;
912 Uint32 flags = surface->flags;
913 SDL_FreeSurface(surface);
914 if (flags & SDL_PREALLOC)
919 SurfaceFlags ( surface )
922 RETVAL = surface->flags;
927 SurfacePalette ( surface )
930 RETVAL = surface->format->palette;
935 SurfaceBitsPerPixel ( surface )
938 RETVAL = surface->format->BitsPerPixel;
943 SurfaceBytesPerPixel ( surface )
946 RETVAL = surface->format->BytesPerPixel;
951 SurfaceRshift ( surface )
954 RETVAL = surface->format->Rshift;
959 SurfaceGshift ( surface )
962 RETVAL = surface->format->Gshift;
967 SurfaceBshift ( surface )
970 RETVAL = surface->format->Bshift;
975 SurfaceAshift ( surface )
978 RETVAL = surface->format->Ashift;
983 SurfaceRmask( surface )
986 RETVAL = surface->format->Rmask;
991 SurfaceGmask ( surface )
994 RETVAL = surface->format->Gmask;
999 SurfaceBmask ( surface )
1000 SDL_Surface *surface
1002 RETVAL = surface->format->Bmask;
1007 SurfaceAmask ( surface )
1008 SDL_Surface *surface
1010 RETVAL = surface->format->Amask;
1015 SurfaceColorKey ( surface )
1016 SDL_Surface *surface
1018 RETVAL = surface->format->colorkey;
1023 SurfaceAlpha( surface )
1024 SDL_Surface *surface
1026 RETVAL = surface->format->alpha;
1031 SurfaceW ( surface )
1032 SDL_Surface *surface
1034 RETVAL = surface->w;
1039 SurfaceH ( surface )
1040 SDL_Surface *surface
1042 RETVAL = surface->h;
1047 SurfacePitch ( surface )
1048 SDL_Surface *surface
1050 RETVAL = surface->pitch;
1055 SurfacePixels ( surface )
1056 SDL_Surface *surface
1058 RETVAL = newSVpvn(surface->pixels,surface->pitch*surface->h);
1063 SurfacePixel ( surface, x, y, ... )
1064 SDL_Surface *surface
1071 int bpp = surface->format->BytesPerPixel;
1072 Uint8* p = (Uint8*)surface->pixels + bpp*x + surface->pitch*y;
1073 if ( items < 3 || items > 4 )
1074 Perl_croak(aTHX_ "usage: SDL::SurfacePixel(surface,x,y,[color])");
1076 color = (SDL_Color*)SvIV(ST(3));
1077 pix = SDL_MapRGB(surface->format,color->r,color->g,color->b);
1086 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
1087 p[0] = (pix >> 16) & 0xff;
1088 p[1] = (pix >> 8) & 0xff;
1092 p[1] = (pix >> 8) & 0xff;
1093 p[2] = (pix >> 16) & 0xff;
1101 RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color));
1105 memcpy(RETVAL,&surface->format->palette[index],sizeof(SDL_Color));
1109 SDL_GetRGB(pix,surface->format,&r,&g,&b);
1117 SDL_GetRGB(pix,surface->format,&r,&g,&b);
1127 MUSTLOCK ( surface )
1128 SDL_Surface *surface
1130 RETVAL = SDL_MUSTLOCK(surface);
1135 SurfaceLock ( surface )
1136 SDL_Surface *surface
1138 RETVAL = SDL_LockSurface(surface);
1143 SurfaceUnlock ( surface )
1144 SDL_Surface *surface
1146 SDL_UnlockSurface(surface);
1151 RETVAL = SDL_GetVideoSurface();
1160 SDL_VideoInfo *info;
1161 info = (SDL_VideoInfo *) safemalloc ( sizeof(SDL_VideoInfo));
1162 memcpy(info,SDL_GetVideoInfo(),sizeof(SDL_VideoInfo));
1164 hv_store(hv,"hw_available",strlen("hw_available"),
1165 newSViv(info->hw_available),0);
1166 hv_store(hv,"wm_available",strlen("wm_available"),
1167 newSViv(info->wm_available),0);
1168 hv_store(hv,"blit_hw",strlen("blit_hw"),
1169 newSViv(info->blit_hw),0);
1170 hv_store(hv,"blit_hw_CC",strlen("blit_hw_CC"),
1171 newSViv(info->blit_hw_CC),0);
1172 hv_store(hv,"blit_hw_A",strlen("blit_hw_A"),
1173 newSViv(info->blit_hw_A),0);
1174 hv_store(hv,"blit_sw",strlen("blit_sw"),
1175 newSViv(info->blit_sw),0);
1176 hv_store(hv,"blit_sw_CC",strlen("blit_sw_CC"),
1177 newSViv(info->blit_sw_CC),0);
1178 hv_store(hv,"blit_sw_A",strlen("blit_sw_A"),
1179 newSViv(info->blit_sw_A),0);
1180 hv_store(hv,"blit_fill",strlen("blit_fill"),
1181 newSViv(info->blit_fill),0);
1182 hv_store(hv,"video_mem",strlen("video_mem"),
1183 newSViv(info->video_mem),0);
1189 NewRect ( x, y, w, h )
1195 RETVAL = (SDL_Rect *) safemalloc (sizeof(SDL_Rect));
1213 if (items > 1 ) rect->x = SvIV(ST(1));
1222 if (items > 1 ) rect->y = SvIV(ST(1));
1231 if (items > 1 ) rect->w = SvIV(ST(1));
1240 if (items > 1 ) rect->h = SvIV(ST(1));
1246 ListModes ( format, flags )
1248 SDL_PixelFormat *format
1252 mode = SDL_ListModes(format,flags);
1253 if (mode == (SDL_Rect**)-1 ) {
1254 av_push(RETVAL,newSVpv("all",0));
1255 } else if (! mode ) {
1256 av_push(RETVAL,newSVpv("none",0));
1258 for (;*mode;mode++) {
1259 av_push(RETVAL,newSViv(PTR2IV(*mode)));
1267 NewColor ( r, g, b )
1272 RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color));
1280 ColorR ( color, ... )
1283 if (items > 1 ) color->r = SvIV(ST(1));
1289 ColorG ( color, ... )
1292 if (items > 1 ) color->g = SvIV(ST(1));
1298 ColorB ( color, ... )
1301 if (items > 1 ) color->b = SvIV(ST(1));
1310 return; safefree(color);
1313 NewPalette ( number )
1316 RETVAL = (SDL_Palette *)safemalloc(sizeof(SDL_Palette));
1317 RETVAL->colors = (SDL_Color *)safemalloc(number *
1319 RETVAL->ncolors = number;
1324 PaletteNColors ( palette, ... )
1325 SDL_Palette *palette
1327 if ( items > 1 ) palette->ncolors = SvIV(ST(1));
1328 RETVAL = palette->ncolors;
1333 PaletteColors ( palette, index, ... )
1334 SDL_Palette *palette
1338 palette->colors[index].r = SvUV(ST(2));
1339 palette->colors[index].g = SvUV(ST(3));
1340 palette->colors[index].b = SvUV(ST(4));
1342 RETVAL = (SDL_Color *)(palette->colors + index);
1347 VideoModeOK ( width, height, bpp, flags )
1353 RETVAL = SDL_VideoModeOK(width,height,bpp,flags);
1358 SetVideoMode ( width, height, bpp, flags )
1364 RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
1369 UpdateRect ( surface, x, y, w ,h )
1370 SDL_Surface *surface
1376 SDL_UpdateRect(surface,x,y,w,h);
1379 UpdateRects ( surface, ... )
1380 SDL_Surface *surface
1382 SDL_Rect *rects, *temp;
1384 if ( items < 2 ) return;
1385 num_rects = items - 1;
1386 rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
1387 for(i=0;i<num_rects;i++) {
1388 temp = (SDL_Rect *)SvIV(ST(i+1));
1389 rects[i].x = temp->x;
1390 rects[i].y = temp->y;
1391 rects[i].w = temp->w;
1392 rects[i].h = temp->h;
1394 SDL_UpdateRects(surface,num_rects,rects);
1399 SDL_Surface *surface
1401 RETVAL = SDL_Flip(surface);
1406 SetColors ( surface, start, ... )
1407 SDL_Surface *surface
1410 SDL_Color *colors,*temp;
1412 if ( items < 3 ) { RETVAL = 0; goto all_done; }
1414 colors = (SDL_Color *)safemalloc(sizeof(SDL_Color)*(length+1));
1415 for ( i = 0; i < length ; i++ ) {
1416 temp = (SDL_Color *)SvIV(ST(i+2));
1417 colors[i].r = temp->r;
1418 colors[i].g = temp->g;
1419 colors[i].b = temp->b;
1421 RETVAL = SDL_SetColors(surface, colors, start, length );
1428 MapRGB ( surface, r, g, b )
1429 SDL_Surface *surface
1434 RETVAL = SDL_MapRGB(surface->format,r,g,b);
1439 MapRGBA ( surface, r, g, b, a )
1440 SDL_Surface *surface
1446 RETVAL = SDL_MapRGBA(surface->format,r,g,b,a);
1451 GetRGB ( surface, pixel )
1452 SDL_Surface *surface
1456 SDL_GetRGB(pixel,surface->format,&r,&g,&b);
1458 av_push(RETVAL,newSViv(r));
1459 av_push(RETVAL,newSViv(g));
1460 av_push(RETVAL,newSViv(b));
1465 GetRGBA ( surface, pixel )
1466 SDL_Surface *surface
1470 SDL_GetRGBA(pixel,surface->format,&r,&g,&b,&a);
1472 av_push(RETVAL,newSViv(r));
1473 av_push(RETVAL,newSViv(g));
1474 av_push(RETVAL,newSViv(b));
1475 av_push(RETVAL,newSViv(a));
1480 SaveBMP ( surface, filename )
1481 SDL_Surface *surface
1484 RETVAL = SDL_SaveBMP(surface,filename);
1489 SetColorKey ( surface, flag, key )
1490 SDL_Surface *surface
1494 Uint32 pixel = SDL_MapRGB(surface->format,key->r,key->g,key->b);
1495 RETVAL = SDL_SetColorKey(surface,flag,pixel);
1500 SetAlpha ( surface, flag, alpha )
1501 SDL_Surface *surface
1505 RETVAL = SDL_SetAlpha(surface,flag,alpha);
1510 DisplayFormat ( surface )
1511 SDL_Surface *surface
1513 RETVAL = SDL_DisplayFormat(surface);
1518 DisplayFormatAlpha ( surface )
1519 SDL_Surface *surface
1521 RETVAL = SDL_DisplayFormatAlpha(surface);
1526 ConvertRGB ( surface )
1527 SDL_Surface * surface
1529 SDL_PixelFormat fmt;
1531 fmt.BitsPerPixel = 24;
1532 fmt.BytesPerPixel = 3;
1533 fmt.Rmask = 0x000000ff;
1534 fmt.Gmask = 0x0000ff00;
1535 fmt.Bmask = 0x00ff0000;
1536 fmt.Amask = 0x00000000;
1547 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1552 ConvertRGBA ( surface )
1553 SDL_Surface * surface
1555 SDL_PixelFormat fmt;
1557 fmt.BitsPerPixel = 32;
1558 fmt.BytesPerPixel = 4;
1559 fmt.Rmask = 0x000000ff;
1560 fmt.Gmask = 0x0000ff00;
1561 fmt.Bmask = 0x00ff0000;
1562 fmt.Amask = 0xff000000;
1573 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1578 BlitSurface ( src, src_rect, dest, dest_rect )
1584 RETVAL = SDL_BlitSurface(src,src_rect,dest,dest_rect);
1589 FillRect ( dest, dest_rect, color )
1594 Uint32 pixel = SDL_MapRGB(dest->format,color->r,color->g,color->b);
1595 RETVAL = SDL_FillRect(dest,dest_rect,pixel);
1602 RETVAL = SDL_GetAppState();
1608 WMSetCaption ( title, icon )
1612 SDL_WM_SetCaption(title,icon);
1618 SDL_WM_GetCaption(&title,&icon);
1620 av_push(RETVAL,newSVpv(title,0));
1621 av_push(RETVAL,newSVpv(icon,0));
1629 SDL_WM_SetIcon(icon,NULL);
1644 mask = SDL_GetMouseState(&x,&y);
1646 av_push(RETVAL,newSViv(mask));
1647 av_push(RETVAL,newSViv(x));
1648 av_push(RETVAL,newSViv(y));
1653 GetRelativeMouseState ()
1658 mask = SDL_GetRelativeMouseState(&x,&y);
1660 av_push(RETVAL,newSViv(mask));
1661 av_push(RETVAL,newSViv(x));
1662 av_push(RETVAL,newSViv(y));
1667 NewCursor ( data, mask, x ,y )
1673 RETVAL = SDL_CreateCursor((Uint8*)data->pixels,
1674 (Uint8*)mask->pixels,data->w,data->h,x,y);
1679 FreeCursor ( cursor )
1682 SDL_FreeCursor(cursor);
1685 SetCursor ( cursor )
1688 SDL_SetCursor(cursor);
1693 RETVAL = SDL_GetCursor();
1698 ShowCursor ( toggle )
1701 RETVAL = SDL_ShowCursor(toggle);
1706 NewAudioSpec ( freq, format, channels, samples )
1712 RETVAL = (SDL_AudioSpec *)safemalloc(sizeof(SDL_AudioSpec));
1713 RETVAL->freq = freq;
1714 RETVAL->format = format;
1715 RETVAL->channels = channels;
1716 RETVAL->samples = samples;
1721 FreeAudioSpec ( spec )
1727 NewAudioCVT ( src_format, src_channels, src_rate, dst_format, dst_channels, dst_rate)
1735 RETVAL = (SDL_AudioCVT *)safemalloc(sizeof(SDL_AudioCVT));
1736 if (SDL_BuildAudioCVT(RETVAL,src_format, src_channels, src_rate,
1737 dst_format, dst_channels, dst_rate)) {
1738 safefree(RETVAL); RETVAL = NULL; }
1743 FreeAudioCVT ( cvt )
1749 ConvertAudioData ( cvt, data, len )
1755 cvt->buf = (Uint8*) safemalloc(cvt->len*cvt->len_mult);
1756 memcpy(cvt->buf,data,cvt->len);
1757 RETVAL = SDL_ConvertAudio(cvt);
1762 OpenAudio ( spec, callback )
1766 spec->userdata = (void*)callback;
1767 spec->callback = sdl_perl_audio_callback;
1768 RETVAL = SDL_OpenAudio(spec,NULL);
1775 RETVAL = SDL_GetAudioStatus ();
1783 SDL_PauseAudio(p_on);
1807 LoadWAV ( filename, spec )
1811 SDL_AudioSpec *temp;
1816 temp = SDL_LoadWAV(filename,spec,&buf,&len);
1817 if ( ! temp ) goto error;
1818 av_push(RETVAL,newSViv(PTR2IV(temp)));
1819 av_push(RETVAL,newSViv(PTR2IV(buf)));
1820 av_push(RETVAL,newSViv(len));
1825 #ifdef HAVE_SDL_MIXER
1828 MixAudio ( dst, src, len, volume )
1834 SDL_MixAudio(dst,src,len,volume);
1837 MixOpenAudio ( frequency, format, channels, chunksize )
1843 RETVAL = Mix_OpenAudio(frequency, format, channels, chunksize);
1848 MixAllocateChannels ( number )
1851 RETVAL = Mix_AllocateChannels(number);
1858 int freq, channels, status;
1860 status = Mix_QuerySpec(&freq,&format,&channels);
1862 av_push(RETVAL,newSViv(status));
1863 av_push(RETVAL,newSViv(freq));
1864 av_push(RETVAL,newSViv(format));
1865 av_push(RETVAL,newSViv(channels));
1870 MixLoadWAV ( filename )
1873 RETVAL = Mix_LoadWAV(filename);
1878 MixLoadMusic ( filename )
1881 RETVAL = Mix_LoadMUS(filename);
1886 MixQuickLoadWAV ( buf )
1889 RETVAL = Mix_QuickLoad_WAV(buf);
1894 MixFreeChunk( chunk )
1897 Mix_FreeChunk(chunk);
1900 MixFreeMusic ( music )
1903 Mix_FreeMusic(music);
1906 MixSetPostMixCallback ( func, arg )
1910 Mix_SetPostMix(func,arg);
1915 RETVAL = sdl_perl_music_callback;
1920 MixSetMusicHook ( func, arg )
1924 Mix_HookMusic(func,arg);
1927 MixSetMusicFinishedHook ( func )
1930 mix_music_finished_cv = func;
1931 Mix_HookMusicFinished(sdl_perl_music_finished_callback);
1934 MixGetMusicHookData ()
1936 RETVAL = Mix_GetMusicHookData();
1941 MixReverseChannels ( number )
1944 RETVAL = Mix_ReserveChannels ( number );
1949 MixGroupChannel ( which, tag )
1953 RETVAL = Mix_GroupChannel(which,tag);
1958 MixGroupChannels ( from, to, tag )
1963 RETVAL = Mix_GroupChannels(from,to,tag);
1968 MixGroupAvailable ( tag )
1971 RETVAL = Mix_GroupAvailable(tag);
1976 MixGroupCount ( tag )
1979 RETVAL = Mix_GroupCount(tag);
1984 MixGroupOldest ( tag )
1987 RETVAL = Mix_GroupOldest(tag);
1992 MixGroupNewer ( tag )
1995 RETVAL = Mix_GroupNewer(tag);
2000 MixPlayChannel ( channel, chunk, loops )
2005 RETVAL = Mix_PlayChannel(channel,chunk,loops);
2010 MixPlayChannelTimed ( channel, chunk, loops, ticks )
2016 RETVAL = Mix_PlayChannelTimed(channel,chunk,loops,ticks);
2021 MixPlayMusic ( music, loops )
2025 RETVAL = Mix_PlayMusic(music,loops);
2030 MixFadeInChannel ( channel, chunk, loops, ms )
2036 RETVAL = Mix_FadeInChannel(channel,chunk,loops,ms);
2041 MixFadeInChannelTimed ( channel, chunk, loops, ms, ticks )
2048 RETVAL = Mix_FadeInChannelTimed(channel,chunk,loops,ms,ticks);
2053 MixFadeInMusic ( music, loops, ms )
2058 RETVAL = Mix_FadeInMusic(music,loops,ms);
2063 MixVolume ( channel, volume )
2067 RETVAL = Mix_Volume(channel,volume);
2072 MixVolumeChunk ( chunk, volume )
2076 RETVAL = Mix_VolumeChunk(chunk,volume);
2081 MixVolumeMusic ( volume )
2084 RETVAL = Mix_VolumeMusic(volume);
2089 MixHaltChannel ( channel )
2092 RETVAL = Mix_HaltChannel(channel);
2097 MixHaltGroup ( tag )
2100 RETVAL = Mix_HaltGroup(tag);
2107 RETVAL = Mix_HaltMusic();
2112 MixExpireChannel ( channel, ticks )
2116 RETVAL = Mix_ExpireChannel ( channel,ticks);
2121 MixFadeOutChannel ( which, ms )
2125 RETVAL = Mix_FadeOutChannel(which,ms);
2130 MixFadeOutGroup ( which, ms )
2134 RETVAL = Mix_FadeOutGroup(which,ms);
2139 MixFadeOutMusic ( ms )
2142 RETVAL = Mix_FadeOutMusic(ms);
2149 RETVAL = Mix_FadingMusic();
2154 MixFadingChannel( which )
2157 RETVAL = Mix_FadingChannel(which);
2162 MixPause ( channel )
2168 MixResume ( channel )
2171 Mix_Resume(channel);
2174 MixPaused ( channel )
2177 RETVAL = Mix_Paused(channel);
2199 RETVAL = Mix_PausedMusic();
2204 MixPlaying( channel )
2207 RETVAL = Mix_Playing(channel);
2214 RETVAL = Mix_PlayingMusic();
2227 GLLoadLibrary ( path )
2230 RETVAL = SDL_GL_LoadLibrary(path);
2235 GLGetProcAddress ( proc )
2238 RETVAL = SDL_GL_GetProcAddress(proc);
2243 GLSetAttribute ( attr, value )
2247 RETVAL = SDL_GL_SetAttribute(attr, value);
2252 GLGetAttribute ( attr )
2257 av_push(RETVAL,newSViv(SDL_GL_GetAttribute(attr, &value)));
2258 av_push(RETVAL,newSViv(value));
2265 SDL_GL_SwapBuffers ();
2271 RETVAL = (SDL_BYTEORDER == SDL_BIG_ENDIAN);
2278 RETVAL = SDL_NumJoysticks();
2283 JoystickName ( index )
2286 RETVAL = (char*)SDL_JoystickName(index);
2291 JoystickOpen ( index )
2294 RETVAL = SDL_JoystickOpen(index);
2299 JoystickOpened ( index )
2302 RETVAL = SDL_JoystickOpened(index);
2307 JoystickIndex ( joystick )
2308 SDL_Joystick *joystick
2310 RETVAL = SDL_JoystickIndex(joystick);
2315 JoystickNumAxes ( joystick )
2316 SDL_Joystick *joystick
2318 RETVAL = SDL_JoystickNumAxes(joystick);
2323 JoystickNumBalls ( joystick )
2324 SDL_Joystick *joystick
2326 RETVAL = SDL_JoystickNumBalls(joystick);
2331 JoystickNumHats ( joystick )
2332 SDL_Joystick *joystick
2334 RETVAL = SDL_JoystickNumHats(joystick);
2339 JoystickNumButtons ( joystick )
2340 SDL_Joystick *joystick
2342 RETVAL = SDL_JoystickNumButtons(joystick);
2349 SDL_JoystickUpdate();
2352 JoystickGetAxis ( joystick, axis )
2353 SDL_Joystick *joystick
2356 RETVAL = SDL_JoystickGetAxis(joystick,axis);
2361 JoystickGetHat ( joystick, hat )
2362 SDL_Joystick *joystick
2365 RETVAL = SDL_JoystickGetHat(joystick,hat);
2370 JoystickGetButton ( joystick, button)
2371 SDL_Joystick *joystick
2374 RETVAL = SDL_JoystickGetButton(joystick,button);
2379 JoystickGetBall ( joystick, ball )
2380 SDL_Joystick *joystick
2384 success = SDL_JoystickGetBall(joystick,ball,&dx,&dy);
2386 av_push(RETVAL,newSViv(success));
2387 av_push(RETVAL,newSViv(dx));
2388 av_push(RETVAL,newSViv(dy));
2393 JoystickClose ( joystick )
2394 SDL_Joystick *joystick
2396 SDL_JoystickClose(joystick);
2399 JoyAxisEventWhich ( e )
2402 RETVAL = e->jaxis.which;
2407 JoyAxisEventAxis ( e )
2410 RETVAL = e->jaxis.axis;
2415 JoyAxisEventValue ( e )
2418 RETVAL = e->jaxis.value;
2423 JoyButtonEventWhich ( e )
2426 RETVAL = e->jbutton.which;
2431 JoyButtonEventButton ( e )
2434 RETVAL = e->jbutton.button;
2439 JoyButtonEventState ( e )
2442 RETVAL = e->jbutton.state;
2447 JoyHatEventWhich ( e )
2450 RETVAL = e->jhat.which;
2455 JoyHatEventHat ( e )
2458 RETVAL = e->jhat.hat;
2463 JoyHatEventValue ( e )
2466 RETVAL = e->jhat.value;
2471 JoyBallEventWhich ( e )
2474 RETVAL = e->jball.which;
2479 JoyBallEventBall ( e )
2482 RETVAL = e->jball.ball;
2487 JoyBallEventXrel ( e )
2490 RETVAL = e->jball.xrel;
2495 JoyBallEventYrel ( e )
2498 RETVAL = e->jball.yrel;
2503 SetClipRect ( surface, rect )
2504 SDL_Surface *surface
2507 SDL_SetClipRect(surface,rect);
2510 GetClipRect ( surface )
2511 SDL_Surface *surface
2513 RETVAL = (SDL_Rect*) safemalloc(sizeof(SDL_Rect));
2514 SDL_GetClipRect(surface,RETVAL);
2524 RETVAL = SDLNet_Init();
2534 NetNewIPaddress ( host, port )
2538 RETVAL = (IPaddress*) safemalloc(sizeof(IPaddress));
2539 RETVAL->host = host;
2540 RETVAL->port = port;
2545 NetIPaddressHost ( ip )
2553 NetIPaddressPort ( ip )
2561 NetFreeIPaddress ( ip )
2567 NetResolveIP ( address )
2570 RETVAL = SDLNet_ResolveIP(address);
2575 NetResolveHost ( address, host, port )
2580 RETVAL = SDLNet_ResolveHost(address,host,port);
2588 RETVAL = SDLNet_TCP_Open(ip);
2593 NetTCPAccept ( server )
2596 RETVAL = SDLNet_TCP_Accept(server);
2601 NetTCPGetPeerAddress ( sock )
2604 RETVAL = SDLNet_TCP_GetPeerAddress(sock);
2609 NetTCPSend ( sock, data, len )
2614 RETVAL = SDLNet_TCP_Send(sock,data,len);
2619 NetTCPRecv ( sock, maxlen )
2625 buffer = safemalloc(maxlen);
2627 status = SDLNet_TCP_Recv(sock,buffer,maxlen);
2628 av_push(RETVAL,newSViv(status));
2629 av_push(RETVAL,newSVpvn((char*)buffer,maxlen));
2634 NetTCPClose ( sock )
2637 SDLNet_TCP_Close(sock);
2640 NetAllocPacket ( size )
2643 RETVAL = SDLNet_AllocPacket(size);
2648 NetAllocPacketV ( howmany, size )
2652 RETVAL = SDLNet_AllocPacketV(howmany,size);
2657 NetResizePacket ( packet, newsize )
2661 RETVAL = SDLNet_ResizePacket(packet,newsize);
2666 NetFreePacket ( packet )
2669 SDLNet_FreePacket(packet);
2672 NetFreePacketV ( packet )
2675 SDLNet_FreePacketV(packet);
2681 RETVAL = SDLNet_UDP_Open(port);
2686 NetUDPBind ( sock, channel, address )
2691 RETVAL = SDLNet_UDP_Bind(sock,channel,address);
2696 NetUDPUnbind ( sock, channel )
2700 SDLNet_UDP_Unbind(sock,channel);
2703 NetUDPGetPeerAddress ( sock, channel )
2707 RETVAL = SDLNet_UDP_GetPeerAddress(sock,channel);
2712 NetUDPSendV ( sock, packets, npackets )
2717 RETVAL = SDLNet_UDP_SendV(sock,packets,npackets);
2722 NetUDPSend ( sock, channel, packet )
2727 RETVAL = SDLNet_UDP_Send(sock,channel,packet);
2732 NetUDPRecvV ( sock, packets )
2736 RETVAL = SDLNet_UDP_RecvV(sock,packets);
2741 NetUDPRecv ( sock, packet )
2745 RETVAL = SDLNet_UDP_Recv(sock,packet);
2750 NetUDPClose ( sock )
2753 SDLNet_UDP_Close(sock);
2756 NetAllocSocketSet ( maxsockets )
2759 RETVAL = SDLNet_AllocSocketSet(maxsockets);
2764 NetTCP_AddSocket ( set, sock )
2765 SDLNet_SocketSet set
2768 RETVAL = SDLNet_TCP_AddSocket(set,sock);
2773 NetUDP_AddSocket ( set, sock )
2774 SDLNet_SocketSet set
2777 RETVAL = SDLNet_UDP_AddSocket(set,sock);
2782 NetTCP_DelSocket ( set, sock )
2783 SDLNet_SocketSet set
2786 RETVAL = SDLNet_TCP_DelSocket(set,sock);
2791 NetUDP_DelSocket ( set, sock )
2792 SDLNet_SocketSet set
2795 RETVAL = SDLNet_UDP_DelSocket(set,sock);
2800 NetCheckSockets ( set, timeout )
2801 SDLNet_SocketSet set
2804 RETVAL = SDLNet_CheckSockets(set,timeout);
2809 NetSocketReady ( sock )
2810 SDLNet_GenericSocket sock
2812 RETVAL = SDLNet_SocketReady(sock);
2817 NetFreeSocketSet ( set )
2818 SDLNet_SocketSet set
2820 SDLNet_FreeSocketSet(set);
2823 NetWrite16 ( value, area )
2827 SDLNet_Write16(value,area);
2830 NetWrite32 ( value, area )
2834 SDLNet_Write32(value,area);
2840 RETVAL = SDLNet_Read16(area);
2848 RETVAL = SDLNet_Read32(area);
2859 RETVAL = TTF_Init();
2869 TTFOpenFont ( file, ptsize )
2873 RETVAL = TTF_OpenFont(file,ptsize);
2878 TTFGetFontStyle ( font )
2881 RETVAL = TTF_GetFontStyle(font);
2886 TTFSetFontStyle ( font, style )
2890 TTF_SetFontStyle(font,style);
2893 TTFFontHeight ( font )
2896 RETVAL = TTF_FontHeight(font);
2901 TTFFontAscent ( font )
2904 RETVAL = TTF_FontAscent(font);
2909 TTFFontDescent ( font )
2912 RETVAL = TTF_FontDescent(font);
2917 TTFFontLineSkip ( font )
2920 RETVAL = TTF_FontLineSkip(font);
2925 TTFGlyphMetrics ( font, ch )
2929 int minx, miny, maxx, maxy, advance;
2931 TTF_GlyphMetrics(font, ch, &minx, &miny, &maxx, &maxy, &advance);
2932 av_push(RETVAL,newSViv(minx));
2933 av_push(RETVAL,newSViv(miny));
2934 av_push(RETVAL,newSViv(maxx));
2935 av_push(RETVAL,newSViv(maxy));
2936 av_push(RETVAL,newSViv(advance));
2941 TTFSizeText ( font, text )
2947 TTF_SizeText(font,text,&w,&h);
2948 av_push(RETVAL,newSViv(w));
2949 av_push(RETVAL,newSViv(h));
2954 TTFSizeUTF8 ( font, text )
2960 TTF_SizeUTF8(font,text,&w,&h);
2961 av_push(RETVAL,newSViv(w));
2962 av_push(RETVAL,newSViv(h));
2967 TTFSizeUNICODE ( font, text )
2973 TTF_SizeUNICODE(font,text,&w,&h);
2974 av_push(RETVAL,newSViv(w));
2975 av_push(RETVAL,newSViv(h));
2980 TTFRenderTextSolid ( font, text, fg )
2985 RETVAL = TTF_RenderText_Solid(font,text,*fg);
2990 TTFRenderUTF8Solid ( font, text, fg )
2995 RETVAL = TTF_RenderUTF8_Solid(font,text,*fg);
3000 TTFRenderUNICODESolid ( font, text, fg )
3005 RETVAL = TTF_RenderUNICODE_Solid(font,text,*fg);
3010 TTFRenderGlyphSolid ( font, ch, fg )
3015 RETVAL = TTF_RenderGlyph_Solid(font,ch,*fg);
3020 TTFRenderTextShaded ( font, text, fg, bg )
3026 RETVAL = TTF_RenderText_Shaded(font,text,*fg,*bg);
3031 TTFRenderUTF8Shaded( font, text, fg, bg )
3037 RETVAL = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3042 TTFRenderUNICODEShaded( font, text, fg, bg )
3048 RETVAL = TTF_RenderUNICODE_Shaded(font,text,*fg,*bg);
3053 TTFRenderGlyphShaded ( font, ch, fg, bg )
3059 RETVAL = TTF_RenderGlyph_Shaded(font,ch,*fg,*bg);
3064 TTFRenderTextBlended( font, text, fg )
3069 RETVAL = TTF_RenderText_Blended(font,text,*fg);
3074 TTFRenderUTF8Blended( font, text, fg )
3079 RETVAL = TTF_RenderUTF8_Blended(font,text,*fg);
3084 TTFRenderUNICODEBlended( font, text, fg )
3089 RETVAL = TTF_RenderUNICODE_Blended(font,text,*fg);
3094 TTFRenderGlyphBlended( font, ch, fg )
3099 RETVAL = TTF_RenderGlyph_Blended(font,ch,*fg);
3104 TTFCloseFont ( font )
3107 TTF_CloseFont(font);
3108 font=NULL; //to be safe http://sdl.beuc.net/sdl.wiki/SDL_ttf_copy_Functions_Management_TTF_CloseFont
3111 TTFPutString ( font, mode, surface, x, y, fg, bg, text )
3114 SDL_Surface *surface
3129 img = TTF_RenderText_Solid(font,text,*fg);
3130 TTF_SizeText(font,text,&w,&h);
3135 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3136 TTF_SizeText(font,text,&w,&h);
3141 img = TTF_RenderText_Blended(font,text,*fg);
3142 TTF_SizeText(font,text,&w,&h);
3147 img = TTF_RenderUTF8_Solid(font,text,*fg);
3148 TTF_SizeUTF8(font,text,&w,&h);
3153 img = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3154 TTF_SizeUTF8(font,text,&w,&h);
3159 img = TTF_RenderUTF8_Blended(font,text,*fg);
3160 TTF_SizeUTF8(font,text,&w,&h);
3165 img = TTF_RenderUNICODE_Solid(font,(Uint16*)text,*fg);
3166 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3170 case UNICODE_SHADED:
3171 img = TTF_RenderUNICODE_Shaded(font,(Uint16*)text,*fg,*bg);
3172 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3176 case UNICODE_BLENDED:
3177 img = TTF_RenderUNICODE_Blended(font,(Uint16*)text,*fg);
3178 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3183 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3184 TTF_SizeText(font,text,&w,&h);
3188 if ( img && img->format && img->format->palette ) {
3189 SDL_Color *c = &img->format->palette->colors[0];
3190 Uint32 key = SDL_MapRGB( img->format, c->r, c->g, c->b );
3191 SDL_SetColorKey(img,SDL_SRCCOLORKEY,key );
3192 if (0 > SDL_BlitSurface(img,NULL,surface,&dest)) {
3193 SDL_FreeSurface(img);
3205 CreateYUVOverlay ( width, height, format, display )
3209 SDL_Surface *display
3211 RETVAL = SDL_CreateYUVOverlay ( width, height, format, display );
3216 LockYUVOverlay ( overlay )
3217 SDL_Overlay *overlay
3219 RETVAL = SDL_LockYUVOverlay(overlay);
3224 UnlockYUVOverlay ( overlay )
3225 SDL_Overlay *overlay
3227 SDL_UnlockYUVOverlay(overlay);
3230 DisplayYUVOverlay ( overlay, dstrect )
3231 SDL_Overlay *overlay
3234 RETVAL = SDL_DisplayYUVOverlay ( overlay, dstrect );
3239 FreeYUVOverlay ( overlay )
3240 SDL_Overlay *overlay
3242 SDL_FreeYUVOverlay ( overlay );
3245 OverlayFormat ( overlay, ... )
3246 SDL_Overlay *overlay
3249 overlay->format = SvIV(ST(1));
3250 RETVAL = overlay->format;
3255 OverlayW ( overlay, ... )
3256 SDL_Overlay *overlay
3259 overlay->w = SvIV(ST(1));
3260 RETVAL = overlay->w;
3265 OverlayH ( overlay, ... )
3266 SDL_Overlay *overlay
3269 overlay->h = SvIV(ST(1));
3270 RETVAL = overlay->h;
3275 OverlayPlanes ( overlay, ... )
3276 SDL_Overlay *overlay
3279 overlay->planes = SvIV(ST(1));
3280 RETVAL = overlay->planes;
3285 OverlayHW ( overlay )
3286 SDL_Overlay *overlay
3288 RETVAL = overlay->hw_overlay;
3293 OverlayPitches ( overlay )
3294 SDL_Overlay *overlay
3296 RETVAL = overlay->pitches;
3301 OverlayPixels ( overlay )
3302 SDL_Overlay *overlay
3304 RETVAL = overlay->pixels;
3309 WMToggleFullScreen ( surface )
3310 SDL_Surface *surface
3312 RETVAL = SDL_WM_ToggleFullScreen(surface);
3317 WMGrabInput ( mode )
3320 RETVAL = SDL_WM_GrabInput(mode);
3327 RETVAL = SDL_WM_IconifyWindow();
3335 RETVAL = e->resize.w;
3343 RETVAL = e->resize.h;
3351 RETVAL = SDL_AudioDriverName(name,32);
3359 if (k >= SDLK_LAST) Perl_croak (aTHX_ "Key out of range");
3360 RETVAL = SDL_GetKeyState(NULL)[k];
3369 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3374 FreeSMPEGInfo ( info )
3380 SMPEGInfoHasAudio ( info )
3383 RETVAL = info->has_audio;
3388 SMPEGInfoHasVideo ( info )
3391 RETVAL = info->has_video;
3396 SMPEGInfoWidth ( info )
3399 RETVAL = info->width;
3404 SMPEGInfoHeight ( info )
3407 RETVAL = info->height;
3412 SMPEGInfoCurrentFrame ( info )
3415 RETVAL = info->current_frame;
3420 SMPEGInfoCurrentFPS ( info )
3423 RETVAL = info->current_fps;
3428 SMPEGInfoCurrentAudioFrame ( info )
3431 RETVAL = info->audio_current_frame;
3436 SMPEGInfoCurrentOffset ( info )
3439 RETVAL = info->current_offset;
3444 SMPEGInfoTotalSize ( info )
3447 RETVAL = info->total_size;
3452 SMPEGInfoCurrentTime ( info )
3455 RETVAL = info->current_time;
3460 SMPEGInfoTotalTime ( info )
3463 RETVAL = info->total_time;
3471 RETVAL = SMPEG_error(mpeg);
3476 NewSMPEG ( filename, info, use_audio )
3481 #ifdef HAVE_SDL_MIXER
3482 RETVAL = SMPEG_new(filename,info,0);
3484 RETVAL = SMPEG_new(filename,info,use_audio);
3496 SMPEGEnableAudio ( mpeg , flag )
3500 SMPEG_enableaudio(mpeg,flag);
3501 #ifdef HAVE_SDL_MIXER
3502 sdl_perl_use_smpeg_audio = flag;
3506 SMPEGEnableVideo ( mpeg , flag )
3510 SMPEG_enablevideo(mpeg,flag);
3513 SMPEGSetVolume ( mpeg , volume )
3517 SMPEG_setvolume(mpeg,volume);
3520 SMPEGSetDisplay ( mpeg, dest, surfLock )
3525 SMPEG_setdisplay(mpeg,dest,surfLock,NULL);
3528 SMPEGScaleXY ( mpeg, w, h)
3533 SMPEG_scaleXY(mpeg,w,h);
3536 SMPEGScale ( mpeg, scale )
3540 SMPEG_scale(mpeg,scale);
3546 SDL_AudioSpec audiofmt;
3549 #ifdef HAVE_SDL_MIXER
3550 if (sdl_perl_use_smpeg_audio ) {
3551 SMPEG_enableaudio(mpeg, 0);
3552 Mix_QuerySpec(&freq, &format, &channels);
3553 audiofmt.format = format;
3554 audiofmt.freq = freq;
3555 audiofmt.channels = channels;
3556 SMPEG_actualSpec(mpeg, &audiofmt);
3557 Mix_HookMusic(SMPEG_playAudioSDL, mpeg);
3558 SMPEG_enableaudio(mpeg, 1);
3564 SMPEGStatus ( mpeg )
3567 RETVAL = SMPEG_status(mpeg);
3578 SMPEGLoop ( mpeg, repeat )
3582 SMPEG_loop(mpeg,repeat);
3589 #ifdef HAVE_SDL_MIXER
3590 Mix_HookMusic(NULL, NULL);
3594 SMPEGRewind ( mpeg )
3600 SMPEGSeek ( mpeg, bytes )
3604 SMPEG_seek(mpeg,bytes);
3607 SMPEGSkip ( mpeg, seconds )
3611 SMPEG_skip(mpeg,seconds);
3614 SMPEGSetDisplayRegion ( mpeg, rect )
3618 SMPEG_setdisplayregion(mpeg,rect->x,rect->y,rect->w,rect->h);
3621 SMPEGRenderFrame ( mpeg, frame )
3625 SMPEG_renderFrame(mpeg,frame);
3628 SMPEGGetInfo ( mpeg )
3631 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3632 SMPEG_getinfo(mpeg,RETVAL);
3642 GFXRotoZoom ( src, angle, zoom, smooth)
3648 RETVAL = rotozoomSurface( src, angle, zoom, smooth);
3653 GFXZoom ( src, zoomx, zoomy, smooth)
3659 RETVAL = zoomSurface( src, zoomx, zoomy, smooth);
3664 GFXPixelColor ( dst, x, y, color )
3670 RETVAL = pixelColor( dst, x, y, color);
3675 GFXPixelRGBA ( dst, x, y, r, g, b, a )
3684 RETVAL = pixelRGBA( dst, x, y, r, g, b, a );
3689 GFXHlineColor ( dst, x1, x2, y, color )
3696 RETVAL = hlineColor( dst, x1, x2, y, color );
3701 GFXHlineRGBA ( dst, x1, x2, y, r, g, b, a )
3711 RETVAL = hlineRGBA( dst, x1, x2, y, r, g, b, a );
3716 GFXVlineColor ( dst, x, y1, y2, color )
3723 RETVAL = vlineColor( dst, x, y1, y2, color );
3728 GFXVlineRGBA ( dst, x, y1, y2, r, g, b, a )
3738 RETVAL = vlineRGBA( dst, x, y1, y2, r, g, b, a );
3743 GFXRectangleColor ( dst, x1, y1, x2, y2, color )
3751 RETVAL = rectangleColor( dst, x1, y1, x2, y2, color );
3756 GFXRectangleRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3767 RETVAL = rectangleRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3772 GFXBoxColor ( dst, x1, y1, x2, y2, color )
3780 RETVAL = boxColor( dst, x1, y1, x2, y2, color );
3785 GFXBoxRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3796 RETVAL = boxRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3801 GFXLineColor ( dst, x1, y1, x2, y2, color )
3809 RETVAL = lineColor( dst, x1, y1, x2, y2, color );
3814 GFXLineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3825 RETVAL = lineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3830 GFXAalineColor ( dst, x1, y1, x2, y2, color )
3838 RETVAL = aalineColor( dst, x1, y1, x2, y2, color );
3843 GFXAalineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3854 RETVAL = aalineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3859 GFXCircleColor ( dst, x, y, r, color )
3866 RETVAL = circleColor( dst, x, y, r, color );
3871 GFXCircleRGBA ( dst, x, y, rad, r, g, b, a )
3881 RETVAL = circleRGBA( dst, x, y, rad, r, g, b, a );
3886 GFXAacircleColor ( dst, x, y, r, color )
3893 RETVAL = aacircleColor( dst, x, y, r, color );
3898 GFXAacircleRGBA ( dst, x, y, rad, r, g, b, a )
3908 RETVAL = aacircleRGBA( dst, x, y, rad, r, g, b, a );
3913 GFXFilledCircleColor ( dst, x, y, r, color )
3920 RETVAL = filledCircleColor( dst, x, y, r, color );
3925 GFXFilledCircleRGBA ( dst, x, y, rad, r, g, b, a )
3935 RETVAL = filledCircleRGBA( dst, x, y, rad, r, g, b, a );
3940 GFXEllipseColor ( dst, x, y, rx, ry, color )
3948 RETVAL = ellipseColor( dst, x, y, rx, ry, color );
3953 GFXEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
3964 RETVAL = ellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
3969 GFXAaellipseColor ( dst, xc, yc, rx, ry, color )
3977 RETVAL = aaellipseColor( dst, xc, yc, rx, ry, color );
3982 GFXAaellipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
3993 RETVAL = aaellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
3998 GFXFilledEllipseColor ( dst, x, y, rx, ry, color )
4006 RETVAL = filledEllipseColor( dst, x, y, rx, ry, color );
4011 GFXFilledEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
4022 RETVAL = filledEllipseRGBA( dst, x, y, rx, ry, r, g, b, a );
4027 GFXFilledPieColor ( dst, x, y, rad, start, end, color )
4036 RETVAL = filledPieColor( dst, x, y, rad, start, end, color );
4041 GFXFilledPieRGBA ( dst, x, y, rad, start, end, r, g, b, a )
4053 RETVAL = filledPieRGBA( dst, x, y, rad, start, end, r, g, b, a );
4058 GFXPolygonColor ( dst, vx, vy, n, color )
4065 RETVAL = polygonColor( dst, vx, vy, n, color );
4070 GFXPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4080 RETVAL = polygonRGBA( dst, vx, vy, n, r, g, b, a );
4085 GFXAapolygonColor ( dst, vx, vy, n, color )
4092 RETVAL = aapolygonColor( dst, vx, vy, n, color );
4097 GFXAapolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4107 RETVAL = aapolygonRGBA( dst, vx, vy, n, r, g, b, a );
4112 GFXFilledPolygonColor ( dst, vx, vy, n, color )
4119 RETVAL = filledPolygonColor( dst, vx, vy, n, color );
4124 GFXFilledPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4134 RETVAL = filledPolygonRGBA( dst, vx, vy, n, r, g, b, a );
4139 GFXCharacterColor ( dst, x, y, c, color )
4146 RETVAL = characterColor( dst, x, y, c, color );
4151 GFXCharacterRGBA ( dst, x, y, c, r, g, b, a )
4161 RETVAL = characterRGBA( dst, x, y, c, r, g, b, a );
4166 GFXStringColor ( dst, x, y, c, color )
4173 RETVAL = stringColor( dst, x, y, c, color );
4178 GFXStringRGBA ( dst, x, y, c, r, g, b, a )
4188 RETVAL = stringRGBA( dst, x, y, c, r, g, b, a );
4198 SVG_Load ( filename )
4201 RETVAL = SVG_Load(filename);
4206 SVG_LoadBuffer ( data, len )
4210 RETVAL = SVG_LoadBuffer(data,len);
4215 SVG_SetOffset ( source, xoff, yoff )
4216 SDL_svg_context* source
4220 RETVAL = SVG_SetOffset(source,xoff,yoff);
4225 SVG_SetScale ( source, xscale, yscale )
4226 SDL_svg_context* source
4230 RETVAL = SVG_SetScale(source,xscale,yscale);
4235 SVG_RenderToSurface ( source, x, y, dest )
4236 SDL_svg_context* source
4241 RETVAL = SVG_RenderToSurface(source,x,y,dest);
4247 SDL_svg_context* source
4252 SVG_Set_Flags ( source, flags )
4253 SDL_svg_context* source
4256 SVG_Set_Flags(source,flags);
4259 SVG_Width ( source )
4260 SDL_svg_context* source
4262 RETVAL = SVG_Width(source);
4267 SVG_HEIGHT ( source )
4268 SDL_svg_context* source
4270 RETVAL = SVG_Height(source);
4275 SVG_SetClipping ( source, minx, miny, maxx, maxy )
4276 SDL_svg_context* source
4282 SVG_SetClipping(source,minx,miny,maxx,maxy);
4287 RETVAL = SVG_Version();
4294 #ifdef HAVE_SDL_SOUND
4297 SoundAudioInfoFormat ( audioinfo )
4298 Sound_AudioInfo* audioinfo
4300 RETVAL = audioinfo->format;
4305 SoundAudioInfoChannels ( audioinfo )
4306 Sound_AudioInfo* audioinfo
4308 RETVAL = audioinfo->channels;
4313 SoundAudioInforate ( audioinfo )
4314 Sound_AudioInfo* audioinfo
4316 RETVAL = audioinfo->rate;
4321 SoundDecoderInfoExtensions ( decoderinfo )
4322 Sound_DecoderInfo* decoderinfo
4325 for ( ext = decoderinfo->extensions; *ext != NULL; ext++ ){
4326 av_push(RETVAL,newSVpv(*ext,0));
4332 SoundDecoderInfoDescription ( decoderinfo )
4333 Sound_DecoderInfo* decoderinfo
4335 RETVAL = decoderinfo->description;
4340 SoundDecoderInfoAuthor ( decoderinfo )
4341 Sound_DecoderInfo* decoderinfo
4343 RETVAL = decoderinfo->author;
4348 SoundDecoderInfoUrl ( decoderinfo )
4349 Sound_DecoderInfo* decoderinfo
4351 RETVAL = decoderinfo->url;
4355 const Sound_DecoderInfo*
4356 SoundSampleDecoder ( sample )
4357 Sound_Sample* sample
4359 RETVAL = sample->decoder;
4364 SoundSampleDesired ( sample )
4365 Sound_Sample* sample
4367 RETVAL = &sample->desired;
4372 SoundSampleAcutal ( sample )
4373 Sound_Sample* sample
4375 RETVAL = &sample->actual;
4380 SoundSampleBuffer ( sample )
4381 Sound_Sample* sample
4383 RETVAL = sample->buffer;
4388 SoundSampleBufferSize ( sample )
4389 Sound_Sample* sample
4391 RETVAL = sample->buffer_size;
4396 SoundSampleFlags ( sample )
4397 Sound_Sample* sample
4399 RETVAL = (Uint32)sample->flags;
4406 RETVAL = Sound_Init();
4413 RETVAL = Sound_Quit();
4418 Sound_AvailableDecoders ( )
4421 const Sound_DecoderInfo** sdi;
4422 sdi = Sound_AvailableDecoders();
4424 for (;*sdi != NULL; ++sdi) {
4425 av_push(RETVAL,sv_2mortal(newSViv(PTR2IV(*sdi))));
4434 RETVAL = Sound_GetError();
4439 Sound_ClearError ( )
4444 Sound_NewSample ( rw, ext, desired, buffsize )
4447 Sound_AudioInfo* desired
4450 RETVAL = Sound_NewSample(rw,ext,desired,buffsize);
4455 Sound_NewSampleFromMem ( data, size, ext, desired, buffsize )
4459 Sound_AudioInfo* desired
4462 RETVAL = Sound_NewSampleFromMem(data,size,ext,desired,buffsize);
4467 Sound_NewSampleFromFile ( fname, desired, buffsize )
4469 Sound_AudioInfo* desired
4472 RETVAL = Sound_NewSampleFromFile(fname,desired,buffsize);
4477 Sound_FreeSample ( sample )
4478 Sound_Sample* sample
4480 Sound_FreeSample(sample);
4483 Sound_GetDuration ( sample )
4484 Sound_Sample* sample
4486 RETVAL = Sound_GetDuration(sample);
4491 Sound_SetBufferSize ( sample, size )
4492 Sound_Sample* sample
4495 RETVAL = Sound_SetBufferSize(sample,size);
4500 Sound_Decode ( sample )
4501 Sound_Sample* sample
4503 RETVAL = Sound_Decode(sample);
4508 Sound_DecodeAll ( sample )
4509 Sound_Sample* sample
4511 RETVAL = Sound_DecodeAll(sample);
4516 Sound_Rewind ( sample )
4517 Sound_Sample* sample
4519 RETVAL = Sound_Rewind(sample);
4524 Sound_Seek ( sample, ms )
4525 Sound_Sample* sample
4528 RETVAL = Sound_Seek(sample,ms);
4534 MODULE = SDL PACKAGE = SDL
4535 PROTOTYPES : DISABLE