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);
861 #ifdef HAVE_SDL_IMAGE
864 IMG_Load ( filename )
867 char* CLASS = "SDL::Surface";
868 RETVAL = IMG_Load(filename);
876 Comment out for now as it does not compile
879 CreateRGBSurfaceFrom (pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask )
891 Uint32 len = pitch * height;
892 New(0,pixeldata,len,Uint8);
893 Copy(pixels,pixeldata,len,Uint8);
894 RETVAL = SDL_CreateRGBSurfaceFrom ( pixeldata, width, height,
895 depth, pitch, Rmask, Gmask, Bmask, Amask );
900 SurfaceCopy ( surface )
904 Uint32 size = surface->pitch * surface->h;
905 New(0,pixels,size,Uint8);
906 Copy(surface->pixels,pixels,size,Uint8);
907 RETVAL = SDL_CreateRGBSurfaceFrom(pixels,surface->w,surface->h,
908 surface->format->BitsPerPixel, surface->pitch,
909 surface->format->Rmask, surface->format->Gmask,
910 surface->format->Bmask, surface->format->Amask);
915 FreeSurface ( surface )
919 Uint8* pixels = surface->pixels;
920 Uint32 flags = surface->flags;
921 SDL_FreeSurface(surface);
922 if (flags & SDL_PREALLOC)
927 SurfaceFlags ( surface )
930 RETVAL = surface->flags;
935 SurfacePalette ( surface )
938 RETVAL = surface->format->palette;
943 SurfaceBitsPerPixel ( surface )
946 RETVAL = surface->format->BitsPerPixel;
951 SurfaceBytesPerPixel ( surface )
954 RETVAL = surface->format->BytesPerPixel;
959 SurfaceRshift ( surface )
962 RETVAL = surface->format->Rshift;
967 SurfaceGshift ( surface )
970 RETVAL = surface->format->Gshift;
975 SurfaceBshift ( surface )
978 RETVAL = surface->format->Bshift;
983 SurfaceAshift ( surface )
986 RETVAL = surface->format->Ashift;
991 SurfaceRmask( surface )
994 RETVAL = surface->format->Rmask;
999 SurfaceGmask ( surface )
1000 SDL_Surface *surface
1002 RETVAL = surface->format->Gmask;
1007 SurfaceBmask ( surface )
1008 SDL_Surface *surface
1010 RETVAL = surface->format->Bmask;
1015 SurfaceAmask ( surface )
1016 SDL_Surface *surface
1018 RETVAL = surface->format->Amask;
1023 SurfaceColorKey ( surface )
1024 SDL_Surface *surface
1026 RETVAL = surface->format->colorkey;
1031 SurfaceAlpha( surface )
1032 SDL_Surface *surface
1034 RETVAL = surface->format->alpha;
1039 SurfaceW ( surface )
1040 SDL_Surface *surface
1042 RETVAL = surface->w;
1047 SurfaceH ( surface )
1048 SDL_Surface *surface
1050 RETVAL = surface->h;
1055 SurfacePitch ( surface )
1056 SDL_Surface *surface
1058 RETVAL = surface->pitch;
1063 SurfacePixels ( surface )
1064 SDL_Surface *surface
1066 RETVAL = newSVpvn(surface->pixels,surface->pitch*surface->h);
1074 Comment out for now as it does not compile
1077 SurfacePixel ( surface, x, y, ... )
1078 SDL_Surface *surface
1085 int bpp = surface->format->BytesPerPixel;
1086 Uint8* p = (Uint8*)surface->pixels + bpp*x + surface->pitch*y;
1087 if ( items < 3 || items > 4 )
1088 Perl_croak(aTHX_ "usage: SDL::SurfacePixel(surface,x,y,[color])");
1090 color = (SDL_Color*)SvIV(ST(3));
1091 pix = SDL_MapRGB(surface->format,color->r,color->g,color->b);
1100 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
1101 p[0] = (pix >> 16) & 0xff;
1102 p[1] = (pix >> 8) & 0xff;
1106 p[1] = (pix >> 8) & 0xff;
1107 p[2] = (pix >> 16) & 0xff;
1115 RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color));
1119 memcpy(RETVAL,&surface->format->palette[index],sizeof(SDL_Color));
1123 SDL_GetRGB(pix,surface->format,&r,&g,&b);
1131 SDL_GetRGB(pix,surface->format,&r,&g,&b);
1141 MUSTLOCK ( surface )
1142 SDL_Surface *surface
1144 RETVAL = SDL_MUSTLOCK(surface);
1149 SurfaceLock ( surface )
1150 SDL_Surface *surface
1152 RETVAL = SDL_LockSurface(surface);
1157 SurfaceUnlock ( surface )
1158 SDL_Surface *surface
1160 SDL_UnlockSurface(surface);
1165 RETVAL = SDL_GetVideoSurface();
1175 SDL_VideoInfo *info;
1176 info = (SDL_VideoInfo *) safemalloc ( sizeof(SDL_VideoInfo));
1177 memcpy(info,SDL_GetVideoInfo(),sizeof(SDL_VideoInfo));
1179 hv_store(hv,"hw_available",strlen("hw_available"),
1180 newSViv(info->hw_available),0);
1181 hv_store(hv,"wm_available",strlen("wm_available"),
1182 newSViv(info->wm_available),0);
1183 hv_store(hv,"blit_hw",strlen("blit_hw"),
1184 newSViv(info->blit_hw),0);
1185 hv_store(hv,"blit_hw_CC",strlen("blit_hw_CC"),
1186 newSViv(info->blit_hw_CC),0);
1187 hv_store(hv,"blit_hw_A",strlen("blit_hw_A"),
1188 newSViv(info->blit_hw_A),0);
1189 hv_store(hv,"blit_sw",strlen("blit_sw"),
1190 newSViv(info->blit_sw),0);
1191 hv_store(hv,"blit_sw_CC",strlen("blit_sw_CC"),
1192 newSViv(info->blit_sw_CC),0);
1193 hv_store(hv,"blit_sw_A",strlen("blit_sw_A"),
1194 newSViv(info->blit_sw_A),0);
1195 hv_store(hv,"blit_fill",strlen("blit_fill"),
1196 newSViv(info->blit_fill),0);
1197 hv_store(hv,"video_mem",strlen("video_mem"),
1198 newSViv(info->video_mem),0);
1204 ListModes ( format, flags )
1206 SDL_PixelFormat *format
1210 mode = SDL_ListModes(format,flags);
1211 if (mode == (SDL_Rect**)-1 ) {
1212 av_push(RETVAL,newSVpv("all",0));
1213 } else if (! mode ) {
1214 av_push(RETVAL,newSVpv("none",0));
1216 for (;*mode;mode++) {
1217 av_push(RETVAL,newSViv(PTR2IV(*mode)));
1224 NewPalette ( number )
1227 RETVAL = (SDL_Palette *)safemalloc(sizeof(SDL_Palette));
1228 RETVAL->colors = (SDL_Color *)safemalloc(number *
1230 RETVAL->ncolors = number;
1235 PaletteNColors ( palette, ... )
1236 SDL_Palette *palette
1238 if ( items > 1 ) palette->ncolors = SvIV(ST(1));
1239 RETVAL = palette->ncolors;
1244 SetVideoMode ( width, height, bpp, flags )
1252 char *CLASS = "SDL::Surface";
1253 RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
1259 SDL_Surface *surface
1261 RETVAL = SDL_Flip(surface);
1266 BlitSurface ( src, src_rect, dest, dest_rect )
1272 RETVAL = SDL_BlitSurface(src,src_rect,dest,dest_rect);
1277 MapRGB ( pixel_format, r, g, b )
1278 SDL_PixelFormat *pixel_format
1283 RETVAL = SDL_MapRGB(pixel_format,r,g,b);
1288 UpdateRect ( surface, x, y, w ,h )
1289 SDL_Surface *surface
1295 SDL_UpdateRect(surface,x,y,w,h);
1299 Comment out for now as it does not compile
1302 PaletteColors ( palette, index, ... )
1303 SDL_Palette *palette
1307 palette->colors[index].r = SvUV(ST(2));
1308 palette->colors[index].g = SvUV(ST(3));
1309 palette->colors[index].b = SvUV(ST(4));
1311 RETVAL = (SDL_Color *)(palette->colors + index);
1318 VideoModeOK ( width, height, bpp, flags )
1324 RETVAL = SDL_VideoModeOK(width,height,bpp,flags);
1329 SetVideoMode ( width, height, bpp, flags )
1335 RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
1340 UpdateRects ( surface, ... )
1341 SDL_Surface *surface
1343 SDL_Rect *rects, *temp;
1345 if ( items < 2 ) return;
1346 num_rects = items - 1;
1347 SDL_UpdateRects(surface,num_rects,rects);
1348 rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
1349 for(i=0;i<num_rects;i++) {
1350 temp = (SDL_Rect *)SvIV(ST(i+1));
1351 rects[i].x = temp->x;
1352 rects[i].y = temp->y;
1353 rects[i].w = temp->w;
1354 rects[i].h = temp->h;
1356 SDL_UpdateRects(surface,num_rects,rects);
1361 SDL_Surface *surface
1363 RETVAL = SDL_Flip(surface);
1368 SetColors ( surface, start, ... )
1369 SDL_Surface *surface
1372 SDL_Color *colors,*temp;
1374 if ( items < 3 ) { RETVAL = 0; goto all_done; }
1376 colors = (SDL_Color *)safemalloc(sizeof(SDL_Color)*(length+1));
1377 for ( i = 0; i < length ; i++ ) {
1378 temp = (SDL_Color *)SvIV(ST(i+2));
1379 colors[i].r = temp->r;
1380 colors[i].g = temp->g;
1381 colors[i].b = temp->b;
1383 RETVAL = SDL_SetColors(surface, colors, start, length );
1390 MapRGBA ( surface, r, g, b, a )
1391 SDL_Surface *surface
1397 RETVAL = SDL_MapRGBA(surface->format,r,g,b,a);
1402 GetRGB ( surface, pixel )
1403 SDL_Surface *surface
1407 SDL_GetRGB(pixel,surface->format,&r,&g,&b);
1409 av_push(RETVAL,newSViv(r));
1410 av_push(RETVAL,newSViv(g));
1411 av_push(RETVAL,newSViv(b));
1416 GetRGBA ( surface, pixel )
1417 SDL_Surface *surface
1421 SDL_GetRGBA(pixel,surface->format,&r,&g,&b,&a);
1423 av_push(RETVAL,newSViv(r));
1424 av_push(RETVAL,newSViv(g));
1425 av_push(RETVAL,newSViv(b));
1426 av_push(RETVAL,newSViv(a));
1431 SaveBMP ( surface, filename )
1432 SDL_Surface *surface
1435 RETVAL = SDL_SaveBMP(surface,filename);
1440 SetColorKey ( surface, flag, key )
1441 SDL_Surface *surface
1445 Uint32 pixel = SDL_MapRGB(surface->format,key->r,key->g,key->b);
1446 RETVAL = SDL_SetColorKey(surface,flag,pixel);
1451 SetAlpha ( surface, flag, alpha )
1452 SDL_Surface *surface
1456 RETVAL = SDL_SetAlpha(surface,flag,alpha);
1461 DisplayFormat ( surface )
1462 SDL_Surface *surface
1464 RETVAL = SDL_DisplayFormat(surface);
1469 DisplayFormatAlpha ( surface )
1470 SDL_Surface *surface
1472 RETVAL = SDL_DisplayFormatAlpha(surface);
1477 ConvertRGB ( surface )
1478 SDL_Surface * surface
1480 SDL_PixelFormat fmt;
1482 fmt.BitsPerPixel = 24;
1483 fmt.BytesPerPixel = 3;
1484 fmt.Rmask = 0x000000ff;
1485 fmt.Gmask = 0x0000ff00;
1486 fmt.Bmask = 0x00ff0000;
1487 fmt.Amask = 0x00000000;
1498 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1503 ConvertRGBA ( surface )
1504 SDL_Surface * surface
1506 SDL_PixelFormat fmt;
1508 fmt.BitsPerPixel = 32;
1509 fmt.BytesPerPixel = 4;
1510 fmt.Rmask = 0x000000ff;
1511 fmt.Gmask = 0x0000ff00;
1512 fmt.Bmask = 0x00ff0000;
1513 fmt.Amask = 0xff000000;
1524 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1531 FillRect ( dest, dest_rect, pixel )
1536 RETVAL = SDL_FillRect(dest,dest_rect,pixel);
1543 RETVAL = SDL_GetAppState();
1549 WMSetCaption ( title, icon )
1553 SDL_WM_SetCaption(title,icon);
1559 SDL_WM_GetCaption(&title,&icon);
1561 av_push(RETVAL,newSVpv(title,0));
1562 av_push(RETVAL,newSVpv(icon,0));
1570 SDL_WM_SetIcon(icon,NULL);
1585 mask = SDL_GetMouseState(&x,&y);
1587 av_push(RETVAL,newSViv(mask));
1588 av_push(RETVAL,newSViv(x));
1589 av_push(RETVAL,newSViv(y));
1594 GetRelativeMouseState ()
1599 mask = SDL_GetRelativeMouseState(&x,&y);
1601 av_push(RETVAL,newSViv(mask));
1602 av_push(RETVAL,newSViv(x));
1603 av_push(RETVAL,newSViv(y));
1608 NewCursor ( data, mask, x ,y )
1614 RETVAL = SDL_CreateCursor((Uint8*)data->pixels,
1615 (Uint8*)mask->pixels,data->w,data->h,x,y);
1620 FreeCursor ( cursor )
1623 SDL_FreeCursor(cursor);
1626 SetCursor ( cursor )
1629 SDL_SetCursor(cursor);
1634 RETVAL = SDL_GetCursor();
1639 ShowCursor ( toggle )
1642 RETVAL = SDL_ShowCursor(toggle);
1647 NewAudioSpec ( freq, format, channels, samples )
1653 RETVAL = (SDL_AudioSpec *)safemalloc(sizeof(SDL_AudioSpec));
1654 RETVAL->freq = freq;
1655 RETVAL->format = format;
1656 RETVAL->channels = channels;
1657 RETVAL->samples = samples;
1662 FreeAudioSpec ( spec )
1668 NewAudioCVT ( src_format, src_channels, src_rate, dst_format, dst_channels, dst_rate)
1676 RETVAL = (SDL_AudioCVT *)safemalloc(sizeof(SDL_AudioCVT));
1677 if (SDL_BuildAudioCVT(RETVAL,src_format, src_channels, src_rate,
1678 dst_format, dst_channels, dst_rate)) {
1679 safefree(RETVAL); RETVAL = NULL; }
1684 FreeAudioCVT ( cvt )
1690 ConvertAudioData ( cvt, data, len )
1696 cvt->buf = (Uint8*) safemalloc(cvt->len*cvt->len_mult);
1697 memcpy(cvt->buf,data,cvt->len);
1698 RETVAL = SDL_ConvertAudio(cvt);
1703 OpenAudio ( spec, callback )
1707 spec->userdata = (void*)callback;
1708 spec->callback = sdl_perl_audio_callback;
1709 RETVAL = SDL_OpenAudio(spec,NULL);
1716 RETVAL = SDL_GetAudioStatus ();
1724 SDL_PauseAudio(p_on);
1748 LoadWAV ( filename, spec )
1752 SDL_AudioSpec *temp;
1757 temp = SDL_LoadWAV(filename,spec,&buf,&len);
1758 if ( ! temp ) goto error;
1759 av_push(RETVAL,newSViv(PTR2IV(temp)));
1760 av_push(RETVAL,newSViv(PTR2IV(buf)));
1761 av_push(RETVAL,newSViv(len));
1766 #ifdef HAVE_SDL_MIXER
1769 MixAudio ( dst, src, len, volume )
1775 SDL_MixAudio(dst,src,len,volume);
1778 MixOpenAudio ( frequency, format, channels, chunksize )
1784 RETVAL = Mix_OpenAudio(frequency, format, channels, chunksize);
1789 MixAllocateChannels ( number )
1792 RETVAL = Mix_AllocateChannels(number);
1799 int freq, channels, status;
1801 status = Mix_QuerySpec(&freq,&format,&channels);
1803 av_push(RETVAL,newSViv(status));
1804 av_push(RETVAL,newSViv(freq));
1805 av_push(RETVAL,newSViv(format));
1806 av_push(RETVAL,newSViv(channels));
1811 MixLoadWAV ( filename )
1814 RETVAL = Mix_LoadWAV(filename);
1819 MixLoadMusic ( filename )
1822 RETVAL = Mix_LoadMUS(filename);
1827 MixQuickLoadWAV ( buf )
1830 RETVAL = Mix_QuickLoad_WAV(buf);
1835 MixFreeChunk( chunk )
1838 Mix_FreeChunk(chunk);
1841 MixFreeMusic ( music )
1844 Mix_FreeMusic(music);
1847 MixSetPostMixCallback ( func, arg )
1851 Mix_SetPostMix(func,arg);
1856 RETVAL = sdl_perl_music_callback;
1861 MixSetMusicHook ( func, arg )
1865 Mix_HookMusic(func,arg);
1868 MixSetMusicFinishedHook ( func )
1871 mix_music_finished_cv = func;
1872 Mix_HookMusicFinished(sdl_perl_music_finished_callback);
1875 MixGetMusicHookData ()
1877 RETVAL = Mix_GetMusicHookData();
1882 MixReverseChannels ( number )
1885 RETVAL = Mix_ReserveChannels ( number );
1890 MixGroupChannel ( which, tag )
1894 RETVAL = Mix_GroupChannel(which,tag);
1899 MixGroupChannels ( from, to, tag )
1904 RETVAL = Mix_GroupChannels(from,to,tag);
1909 MixGroupAvailable ( tag )
1912 RETVAL = Mix_GroupAvailable(tag);
1917 MixGroupCount ( tag )
1920 RETVAL = Mix_GroupCount(tag);
1925 MixGroupOldest ( tag )
1928 RETVAL = Mix_GroupOldest(tag);
1933 MixGroupNewer ( tag )
1936 RETVAL = Mix_GroupNewer(tag);
1941 MixPlayChannel ( channel, chunk, loops )
1946 RETVAL = Mix_PlayChannel(channel,chunk,loops);
1951 MixPlayChannelTimed ( channel, chunk, loops, ticks )
1957 RETVAL = Mix_PlayChannelTimed(channel,chunk,loops,ticks);
1962 MixPlayMusic ( music, loops )
1966 RETVAL = Mix_PlayMusic(music,loops);
1971 MixFadeInChannel ( channel, chunk, loops, ms )
1977 RETVAL = Mix_FadeInChannel(channel,chunk,loops,ms);
1982 MixFadeInChannelTimed ( channel, chunk, loops, ms, ticks )
1989 RETVAL = Mix_FadeInChannelTimed(channel,chunk,loops,ms,ticks);
1994 MixFadeInMusic ( music, loops, ms )
1999 RETVAL = Mix_FadeInMusic(music,loops,ms);
2004 MixVolume ( channel, volume )
2008 RETVAL = Mix_Volume(channel,volume);
2013 MixVolumeChunk ( chunk, volume )
2017 RETVAL = Mix_VolumeChunk(chunk,volume);
2022 MixVolumeMusic ( volume )
2025 RETVAL = Mix_VolumeMusic(volume);
2030 MixHaltChannel ( channel )
2033 RETVAL = Mix_HaltChannel(channel);
2038 MixHaltGroup ( tag )
2041 RETVAL = Mix_HaltGroup(tag);
2048 RETVAL = Mix_HaltMusic();
2053 MixExpireChannel ( channel, ticks )
2057 RETVAL = Mix_ExpireChannel ( channel,ticks);
2062 MixFadeOutChannel ( which, ms )
2066 RETVAL = Mix_FadeOutChannel(which,ms);
2071 MixFadeOutGroup ( which, ms )
2075 RETVAL = Mix_FadeOutGroup(which,ms);
2080 MixFadeOutMusic ( ms )
2083 RETVAL = Mix_FadeOutMusic(ms);
2090 RETVAL = Mix_FadingMusic();
2095 MixFadingChannel( which )
2098 RETVAL = Mix_FadingChannel(which);
2103 MixPause ( channel )
2109 MixResume ( channel )
2112 Mix_Resume(channel);
2115 MixPaused ( channel )
2118 RETVAL = Mix_Paused(channel);
2140 RETVAL = Mix_PausedMusic();
2145 MixPlaying( channel )
2148 RETVAL = Mix_Playing(channel);
2155 RETVAL = Mix_PlayingMusic();
2160 MixSetPanning ( channel, left, right )
2165 RETVAL = Mix_SetPanning(channel, left, right);
2177 GLLoadLibrary ( path )
2180 RETVAL = SDL_GL_LoadLibrary(path);
2185 GLGetProcAddress ( proc )
2188 RETVAL = SDL_GL_GetProcAddress(proc);
2193 GLSetAttribute ( attr, value )
2197 RETVAL = SDL_GL_SetAttribute(attr, value);
2202 GLGetAttribute ( attr )
2207 av_push(RETVAL,newSViv(SDL_GL_GetAttribute(attr, &value)));
2208 av_push(RETVAL,newSViv(value));
2215 SDL_GL_SwapBuffers ();
2221 RETVAL = (SDL_BYTEORDER == SDL_BIG_ENDIAN);
2228 RETVAL = SDL_NumJoysticks();
2233 JoystickName ( index )
2236 RETVAL = (char*)SDL_JoystickName(index);
2241 JoystickOpen ( index )
2244 RETVAL = SDL_JoystickOpen(index);
2249 JoystickOpened ( index )
2252 RETVAL = SDL_JoystickOpened(index);
2257 JoystickIndex ( joystick )
2258 SDL_Joystick *joystick
2260 RETVAL = SDL_JoystickIndex(joystick);
2265 JoystickNumAxes ( joystick )
2266 SDL_Joystick *joystick
2268 RETVAL = SDL_JoystickNumAxes(joystick);
2273 JoystickNumBalls ( joystick )
2274 SDL_Joystick *joystick
2276 RETVAL = SDL_JoystickNumBalls(joystick);
2281 JoystickNumHats ( joystick )
2282 SDL_Joystick *joystick
2284 RETVAL = SDL_JoystickNumHats(joystick);
2289 JoystickNumButtons ( joystick )
2290 SDL_Joystick *joystick
2292 RETVAL = SDL_JoystickNumButtons(joystick);
2299 SDL_JoystickUpdate();
2302 JoystickGetAxis ( joystick, axis )
2303 SDL_Joystick *joystick
2306 RETVAL = SDL_JoystickGetAxis(joystick,axis);
2311 JoystickGetHat ( joystick, hat )
2312 SDL_Joystick *joystick
2315 RETVAL = SDL_JoystickGetHat(joystick,hat);
2320 JoystickGetButton ( joystick, button)
2321 SDL_Joystick *joystick
2324 RETVAL = SDL_JoystickGetButton(joystick,button);
2329 JoystickGetBall ( joystick, ball )
2330 SDL_Joystick *joystick
2334 success = SDL_JoystickGetBall(joystick,ball,&dx,&dy);
2336 av_push(RETVAL,newSViv(success));
2337 av_push(RETVAL,newSViv(dx));
2338 av_push(RETVAL,newSViv(dy));
2343 JoystickClose ( joystick )
2344 SDL_Joystick *joystick
2346 SDL_JoystickClose(joystick);
2349 JoyAxisEventWhich ( e )
2352 RETVAL = e->jaxis.which;
2357 JoyAxisEventAxis ( e )
2360 RETVAL = e->jaxis.axis;
2365 JoyAxisEventValue ( e )
2368 RETVAL = e->jaxis.value;
2373 JoyButtonEventWhich ( e )
2376 RETVAL = e->jbutton.which;
2381 JoyButtonEventButton ( e )
2384 RETVAL = e->jbutton.button;
2389 JoyButtonEventState ( e )
2392 RETVAL = e->jbutton.state;
2397 JoyHatEventWhich ( e )
2400 RETVAL = e->jhat.which;
2405 JoyHatEventHat ( e )
2408 RETVAL = e->jhat.hat;
2413 JoyHatEventValue ( e )
2416 RETVAL = e->jhat.value;
2421 JoyBallEventWhich ( e )
2424 RETVAL = e->jball.which;
2429 JoyBallEventBall ( e )
2432 RETVAL = e->jball.ball;
2437 JoyBallEventXrel ( e )
2440 RETVAL = e->jball.xrel;
2445 JoyBallEventYrel ( e )
2448 RETVAL = e->jball.yrel;
2453 SetClipRect ( surface, rect )
2454 SDL_Surface *surface
2457 SDL_SetClipRect(surface,rect);
2460 GetClipRect ( surface, rect )
2461 SDL_Surface *surface
2464 SDL_GetClipRect(surface, rect);
2472 RETVAL = SDLNet_Init();
2482 NetNewIPaddress ( host, port )
2486 RETVAL = (IPaddress*) safemalloc(sizeof(IPaddress));
2487 RETVAL->host = host;
2488 RETVAL->port = port;
2493 NetIPaddressHost ( ip )
2501 NetIPaddressPort ( ip )
2509 NetFreeIPaddress ( ip )
2515 NetResolveIP ( address )
2518 RETVAL = SDLNet_ResolveIP(address);
2523 NetResolveHost ( address, host, port )
2528 RETVAL = SDLNet_ResolveHost(address,host,port);
2536 RETVAL = SDLNet_TCP_Open(ip);
2541 NetTCPAccept ( server )
2544 RETVAL = SDLNet_TCP_Accept(server);
2549 NetTCPGetPeerAddress ( sock )
2552 RETVAL = SDLNet_TCP_GetPeerAddress(sock);
2557 NetTCPSend ( sock, data, len )
2562 RETVAL = SDLNet_TCP_Send(sock,data,len);
2567 NetTCPRecv ( sock, maxlen )
2573 buffer = safemalloc(maxlen);
2575 status = SDLNet_TCP_Recv(sock,buffer,maxlen);
2576 av_push(RETVAL,newSViv(status));
2577 av_push(RETVAL,newSVpvn((char*)buffer,maxlen));
2582 NetTCPClose ( sock )
2585 SDLNet_TCP_Close(sock);
2588 NetAllocPacket ( size )
2591 RETVAL = SDLNet_AllocPacket(size);
2596 NetAllocPacketV ( howmany, size )
2600 RETVAL = SDLNet_AllocPacketV(howmany,size);
2605 NetResizePacket ( packet, newsize )
2609 RETVAL = SDLNet_ResizePacket(packet,newsize);
2614 NetFreePacket ( packet )
2617 SDLNet_FreePacket(packet);
2620 NetFreePacketV ( packet )
2623 SDLNet_FreePacketV(packet);
2629 RETVAL = SDLNet_UDP_Open(port);
2634 NetUDPBind ( sock, channel, address )
2639 RETVAL = SDLNet_UDP_Bind(sock,channel,address);
2644 NetUDPUnbind ( sock, channel )
2648 SDLNet_UDP_Unbind(sock,channel);
2651 NetUDPGetPeerAddress ( sock, channel )
2655 RETVAL = SDLNet_UDP_GetPeerAddress(sock,channel);
2660 NetUDPSendV ( sock, packets, npackets )
2665 RETVAL = SDLNet_UDP_SendV(sock,packets,npackets);
2670 NetUDPSend ( sock, channel, packet )
2675 RETVAL = SDLNet_UDP_Send(sock,channel,packet);
2680 NetUDPRecvV ( sock, packets )
2684 RETVAL = SDLNet_UDP_RecvV(sock,packets);
2689 NetUDPRecv ( sock, packet )
2693 RETVAL = SDLNet_UDP_Recv(sock,packet);
2698 NetUDPClose ( sock )
2701 SDLNet_UDP_Close(sock);
2704 NetAllocSocketSet ( maxsockets )
2707 RETVAL = SDLNet_AllocSocketSet(maxsockets);
2712 NetTCP_AddSocket ( set, sock )
2713 SDLNet_SocketSet set
2716 RETVAL = SDLNet_TCP_AddSocket(set,sock);
2721 NetUDP_AddSocket ( set, sock )
2722 SDLNet_SocketSet set
2725 RETVAL = SDLNet_UDP_AddSocket(set,sock);
2730 NetTCP_DelSocket ( set, sock )
2731 SDLNet_SocketSet set
2734 RETVAL = SDLNet_TCP_DelSocket(set,sock);
2739 NetUDP_DelSocket ( set, sock )
2740 SDLNet_SocketSet set
2743 RETVAL = SDLNet_UDP_DelSocket(set,sock);
2748 NetCheckSockets ( set, timeout )
2749 SDLNet_SocketSet set
2752 RETVAL = SDLNet_CheckSockets(set,timeout);
2757 NetSocketReady ( sock )
2758 SDLNet_GenericSocket sock
2760 RETVAL = SDLNet_SocketReady(sock);
2765 NetFreeSocketSet ( set )
2766 SDLNet_SocketSet set
2768 SDLNet_FreeSocketSet(set);
2771 NetWrite16 ( value, area )
2775 SDLNet_Write16(value,area);
2778 NetWrite32 ( value, area )
2782 SDLNet_Write32(value,area);
2788 RETVAL = SDLNet_Read16(area);
2796 RETVAL = SDLNet_Read32(area);
2807 RETVAL = TTF_Init();
2817 TTFOpenFont ( file, ptsize )
2821 RETVAL = TTF_OpenFont(file,ptsize);
2826 TTFGetFontStyle ( font )
2829 RETVAL = TTF_GetFontStyle(font);
2834 TTFSetFontStyle ( font, style )
2838 TTF_SetFontStyle(font,style);
2841 TTFFontHeight ( font )
2844 RETVAL = TTF_FontHeight(font);
2849 TTFFontAscent ( font )
2852 RETVAL = TTF_FontAscent(font);
2857 TTFFontDescent ( font )
2860 RETVAL = TTF_FontDescent(font);
2865 TTFFontLineSkip ( font )
2868 RETVAL = TTF_FontLineSkip(font);
2873 TTFGlyphMetrics ( font, ch )
2877 int minx, miny, maxx, maxy, advance;
2879 TTF_GlyphMetrics(font, ch, &minx, &miny, &maxx, &maxy, &advance);
2880 av_push(RETVAL,newSViv(minx));
2881 av_push(RETVAL,newSViv(miny));
2882 av_push(RETVAL,newSViv(maxx));
2883 av_push(RETVAL,newSViv(maxy));
2884 av_push(RETVAL,newSViv(advance));
2889 TTFSizeText ( font, text )
2895 if(TTF_SizeText(font,text,&w,&h))
2897 printf("TTF error at TTFSizeText: %s \n", TTF_GetError());
2898 Perl_croak (aTHX_ "TTF error \n");
2902 av_push(RETVAL,newSViv(w));
2903 av_push(RETVAL,newSViv(h));
2904 sv_2mortal((SV*)RETVAL);
2912 TTFSizeUTF8 ( font, text )
2918 if(TTF_SizeUTF8(font,text,&w,&h))
2920 av_push(RETVAL,newSViv(w));
2921 av_push(RETVAL,newSViv(h));
2922 sv_2mortal((SV*)RETVAL);
2927 printf("TTF error at TTFSizeUTF8 with : %s \n", TTF_GetError());
2928 Perl_croak (aTHX_ "TTF error \n");
2935 TTFSizeUNICODE ( font, text )
2941 if(TTF_SizeUNICODE(font,text,&w,&h))
2943 av_push(RETVAL,newSViv(w));
2944 av_push(RETVAL,newSViv(h));
2945 sv_2mortal((SV*)RETVAL);
2950 printf("TTF error at TTFSizeUNICODE : %s \n", TTF_GetError());
2951 Perl_croak (aTHX_ "TTF error \n");
2960 TTFRenderTextSolid ( font, text, fg )
2965 RETVAL = TTF_RenderText_Solid(font,text,*fg);
2970 TTFRenderUTF8Solid ( font, text, fg )
2975 RETVAL = TTF_RenderUTF8_Solid(font,text,*fg);
2980 TTFRenderUNICODESolid ( font, text, fg )
2985 RETVAL = TTF_RenderUNICODE_Solid(font,text,*fg);
2990 TTFRenderGlyphSolid ( font, ch, fg )
2995 RETVAL = TTF_RenderGlyph_Solid(font,ch,*fg);
3000 TTFRenderTextShaded ( font, text, fg, bg )
3006 RETVAL = TTF_RenderText_Shaded(font,text,*fg,*bg);
3011 TTFRenderUTF8Shaded( font, text, fg, bg )
3017 RETVAL = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3022 TTFRenderUNICODEShaded( font, text, fg, bg )
3028 RETVAL = TTF_RenderUNICODE_Shaded(font,text,*fg,*bg);
3033 TTFRenderGlyphShaded ( font, ch, fg, bg )
3039 RETVAL = TTF_RenderGlyph_Shaded(font,ch,*fg,*bg);
3044 TTFRenderTextBlended( font, text, fg )
3049 RETVAL = TTF_RenderText_Blended(font,text,*fg);
3054 TTFRenderUTF8Blended( font, text, fg )
3059 RETVAL = TTF_RenderUTF8_Blended(font,text,*fg);
3064 TTFRenderUNICODEBlended( font, text, fg )
3069 RETVAL = TTF_RenderUNICODE_Blended(font,text,*fg);
3074 TTFRenderGlyphBlended( font, ch, fg )
3079 RETVAL = TTF_RenderGlyph_Blended(font,ch,*fg);
3084 TTFCloseFont ( font )
3087 TTF_CloseFont(font);
3088 font=NULL; //to be safe http://sdl.beuc.net/sdl.wiki/SDL_ttf_copy_Functions_Management_TTF_CloseFont
3091 TTFPutString ( font, mode, surface, x, y, fg, bg, text )
3094 SDL_Surface *surface
3109 img = TTF_RenderText_Solid(font,text,*fg);
3110 TTF_SizeText(font,text,&w,&h);
3115 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3116 TTF_SizeText(font,text,&w,&h);
3121 img = TTF_RenderText_Blended(font,text,*fg);
3122 TTF_SizeText(font,text,&w,&h);
3127 img = TTF_RenderUTF8_Solid(font,text,*fg);
3128 TTF_SizeUTF8(font,text,&w,&h);
3133 img = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3134 TTF_SizeUTF8(font,text,&w,&h);
3139 img = TTF_RenderUTF8_Blended(font,text,*fg);
3140 TTF_SizeUTF8(font,text,&w,&h);
3145 img = TTF_RenderUNICODE_Solid(font,(Uint16*)text,*fg);
3146 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3150 case UNICODE_SHADED:
3151 img = TTF_RenderUNICODE_Shaded(font,(Uint16*)text,*fg,*bg);
3152 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3156 case UNICODE_BLENDED:
3157 img = TTF_RenderUNICODE_Blended(font,(Uint16*)text,*fg);
3158 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3163 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3164 TTF_SizeText(font,text,&w,&h);
3168 if ( img && img->format && img->format->palette ) {
3169 SDL_Color *c = &img->format->palette->colors[0];
3170 Uint32 key = SDL_MapRGB( img->format, c->r, c->g, c->b );
3171 SDL_SetColorKey(img,SDL_SRCCOLORKEY,key );
3172 if (0 > SDL_BlitSurface(img,NULL,surface,&dest)) {
3173 SDL_FreeSurface(img);
3187 CreateYUVOverlay ( width, height, format, display )
3191 SDL_Surface *display
3193 RETVAL = SDL_CreateYUVOverlay ( width, height, format, display );
3198 LockYUVOverlay ( overlay )
3199 SDL_Overlay *overlay
3201 RETVAL = SDL_LockYUVOverlay(overlay);
3206 UnlockYUVOverlay ( overlay )
3207 SDL_Overlay *overlay
3209 SDL_UnlockYUVOverlay(overlay);
3212 DisplayYUVOverlay ( overlay, dstrect )
3213 SDL_Overlay *overlay
3216 RETVAL = SDL_DisplayYUVOverlay ( overlay, dstrect );
3221 FreeYUVOverlay ( overlay )
3222 SDL_Overlay *overlay
3224 SDL_FreeYUVOverlay ( overlay );
3227 OverlayFormat ( overlay, ... )
3228 SDL_Overlay *overlay
3231 overlay->format = SvIV(ST(1));
3232 RETVAL = overlay->format;
3237 OverlayW ( overlay, ... )
3238 SDL_Overlay *overlay
3241 overlay->w = SvIV(ST(1));
3242 RETVAL = overlay->w;
3247 OverlayH ( overlay, ... )
3248 SDL_Overlay *overlay
3251 overlay->h = SvIV(ST(1));
3252 RETVAL = overlay->h;
3257 OverlayPlanes ( overlay, ... )
3258 SDL_Overlay *overlay
3261 overlay->planes = SvIV(ST(1));
3262 RETVAL = overlay->planes;
3267 OverlayHW ( overlay )
3268 SDL_Overlay *overlay
3270 RETVAL = overlay->hw_overlay;
3275 OverlayPitches ( overlay )
3276 SDL_Overlay *overlay
3278 RETVAL = overlay->pitches;
3283 OverlayPixels ( overlay )
3284 SDL_Overlay *overlay
3286 RETVAL = overlay->pixels;
3291 WMToggleFullScreen ( surface )
3292 SDL_Surface *surface
3294 RETVAL = SDL_WM_ToggleFullScreen(surface);
3299 WMGrabInput ( mode )
3302 RETVAL = SDL_WM_GrabInput(mode);
3309 RETVAL = SDL_WM_IconifyWindow();
3317 RETVAL = e->resize.w;
3325 RETVAL = e->resize.h;
3333 RETVAL = SDL_AudioDriverName(name,32);
3341 if (k >= SDLK_LAST) Perl_croak (aTHX_ "Key out of range");
3342 RETVAL = SDL_GetKeyState(NULL)[k];
3351 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3356 FreeSMPEGInfo ( info )
3362 SMPEGInfoHasAudio ( info )
3365 RETVAL = info->has_audio;
3370 SMPEGInfoHasVideo ( info )
3373 RETVAL = info->has_video;
3378 SMPEGInfoWidth ( info )
3381 RETVAL = info->width;
3386 SMPEGInfoHeight ( info )
3389 RETVAL = info->height;
3394 SMPEGInfoCurrentFrame ( info )
3397 RETVAL = info->current_frame;
3402 SMPEGInfoCurrentFPS ( info )
3405 RETVAL = info->current_fps;
3410 SMPEGInfoCurrentAudioFrame ( info )
3413 RETVAL = info->audio_current_frame;
3418 SMPEGInfoCurrentOffset ( info )
3421 RETVAL = info->current_offset;
3426 SMPEGInfoTotalSize ( info )
3429 RETVAL = info->total_size;
3434 SMPEGInfoCurrentTime ( info )
3437 RETVAL = info->current_time;
3442 SMPEGInfoTotalTime ( info )
3445 RETVAL = info->total_time;
3453 RETVAL = SMPEG_error(mpeg);
3458 NewSMPEG ( filename, info, use_audio )
3463 #ifdef HAVE_SDL_MIXER
3464 RETVAL = SMPEG_new(filename,info,0);
3466 RETVAL = SMPEG_new(filename,info,use_audio);
3478 SMPEGEnableAudio ( mpeg , flag )
3482 SMPEG_enableaudio(mpeg,flag);
3483 #ifdef HAVE_SDL_MIXER
3484 sdl_perl_use_smpeg_audio = flag;
3488 SMPEGEnableVideo ( mpeg , flag )
3492 SMPEG_enablevideo(mpeg,flag);
3495 SMPEGSetVolume ( mpeg , volume )
3499 SMPEG_setvolume(mpeg,volume);
3502 SMPEGSetDisplay ( mpeg, dest, surfLock )
3507 SMPEG_setdisplay(mpeg,dest,surfLock,NULL);
3510 SMPEGScaleXY ( mpeg, w, h)
3515 SMPEG_scaleXY(mpeg,w,h);
3518 SMPEGScale ( mpeg, scale )
3522 SMPEG_scale(mpeg,scale);
3528 SDL_AudioSpec audiofmt;
3531 #ifdef HAVE_SDL_MIXER
3532 if (sdl_perl_use_smpeg_audio ) {
3533 SMPEG_enableaudio(mpeg, 0);
3534 Mix_QuerySpec(&freq, &format, &channels);
3535 audiofmt.format = format;
3536 audiofmt.freq = freq;
3537 audiofmt.channels = channels;
3538 SMPEG_actualSpec(mpeg, &audiofmt);
3539 Mix_HookMusic(SMPEG_playAudioSDL, mpeg);
3540 SMPEG_enableaudio(mpeg, 1);
3546 SMPEGStatus ( mpeg )
3549 RETVAL = SMPEG_status(mpeg);
3560 SMPEGLoop ( mpeg, repeat )
3564 SMPEG_loop(mpeg,repeat);
3571 #ifdef HAVE_SDL_MIXER
3572 Mix_HookMusic(NULL, NULL);
3576 SMPEGRewind ( mpeg )
3582 SMPEGSeek ( mpeg, bytes )
3586 SMPEG_seek(mpeg,bytes);
3589 SMPEGSkip ( mpeg, seconds )
3593 SMPEG_skip(mpeg,seconds);
3596 SMPEGSetDisplayRegion ( mpeg, rect )
3600 SMPEG_setdisplayregion(mpeg,rect->x,rect->y,rect->w,rect->h);
3603 SMPEGRenderFrame ( mpeg, frame )
3607 SMPEG_renderFrame(mpeg,frame);
3610 SMPEGGetInfo ( mpeg )
3613 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3614 SMPEG_getinfo(mpeg,RETVAL);
3626 GFXRotoZoom ( src, angle, zoom, smooth)
3632 RETVAL = rotozoomSurface( src, angle, zoom, smooth);
3637 GFXZoom ( src, zoomx, zoomy, smooth)
3643 RETVAL = zoomSurface( src, zoomx, zoomy, smooth);
3650 GFXPixelColor ( dst, x, y, color )
3656 RETVAL = pixelColor( dst, x, y, color);
3661 GFXPixelRGBA ( dst, x, y, r, g, b, a )
3670 RETVAL = pixelRGBA( dst, x, y, r, g, b, a );
3675 GFXHlineColor ( dst, x1, x2, y, color )
3682 RETVAL = hlineColor( dst, x1, x2, y, color );
3687 GFXHlineRGBA ( dst, x1, x2, y, r, g, b, a )
3697 RETVAL = hlineRGBA( dst, x1, x2, y, r, g, b, a );
3702 GFXVlineColor ( dst, x, y1, y2, color )
3709 RETVAL = vlineColor( dst, x, y1, y2, color );
3714 GFXVlineRGBA ( dst, x, y1, y2, r, g, b, a )
3724 RETVAL = vlineRGBA( dst, x, y1, y2, r, g, b, a );
3729 GFXRectangleColor ( dst, x1, y1, x2, y2, color )
3737 RETVAL = rectangleColor( dst, x1, y1, x2, y2, color );
3742 GFXRectangleRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3753 RETVAL = rectangleRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3758 GFXBoxColor ( dst, x1, y1, x2, y2, color )
3766 RETVAL = boxColor( dst, x1, y1, x2, y2, color );
3771 GFXBoxRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3782 RETVAL = boxRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3787 GFXLineColor ( dst, x1, y1, x2, y2, color )
3795 RETVAL = lineColor( dst, x1, y1, x2, y2, color );
3800 GFXLineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3811 RETVAL = lineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3816 GFXAalineColor ( dst, x1, y1, x2, y2, color )
3824 RETVAL = aalineColor( dst, x1, y1, x2, y2, color );
3829 GFXAalineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3840 RETVAL = aalineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3845 GFXCircleColor ( dst, x, y, r, color )
3852 RETVAL = circleColor( dst, x, y, r, color );
3857 GFXCircleRGBA ( dst, x, y, rad, r, g, b, a )
3867 RETVAL = circleRGBA( dst, x, y, rad, r, g, b, a );
3872 GFXAacircleColor ( dst, x, y, r, color )
3879 RETVAL = aacircleColor( dst, x, y, r, color );
3884 GFXAacircleRGBA ( dst, x, y, rad, r, g, b, a )
3894 RETVAL = aacircleRGBA( dst, x, y, rad, r, g, b, a );
3899 GFXFilledCircleColor ( dst, x, y, r, color )
3906 RETVAL = filledCircleColor( dst, x, y, r, color );
3911 GFXFilledCircleRGBA ( dst, x, y, rad, r, g, b, a )
3921 RETVAL = filledCircleRGBA( dst, x, y, rad, r, g, b, a );
3926 GFXEllipseColor ( dst, x, y, rx, ry, color )
3934 RETVAL = ellipseColor( dst, x, y, rx, ry, color );
3939 GFXEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
3950 RETVAL = ellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
3955 GFXAaellipseColor ( dst, xc, yc, rx, ry, color )
3963 RETVAL = aaellipseColor( dst, xc, yc, rx, ry, color );
3968 GFXAaellipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
3979 RETVAL = aaellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
3984 GFXFilledEllipseColor ( dst, x, y, rx, ry, color )
3992 RETVAL = filledEllipseColor( dst, x, y, rx, ry, color );
3997 GFXFilledEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
4008 RETVAL = filledEllipseRGBA( dst, x, y, rx, ry, r, g, b, a );
4013 GFXFilledPieColor ( dst, x, y, rad, start, end, color )
4022 RETVAL = filledPieColor( dst, x, y, rad, start, end, color );
4027 GFXFilledPieRGBA ( dst, x, y, rad, start, end, r, g, b, a )
4039 RETVAL = filledPieRGBA( dst, x, y, rad, start, end, r, g, b, a );
4044 GFXPolygonColor ( dst, vx, vy, n, color )
4051 RETVAL = polygonColor( dst, vx, vy, n, color );
4056 GFXPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4066 RETVAL = polygonRGBA( dst, vx, vy, n, r, g, b, a );
4071 GFXAapolygonColor ( dst, vx, vy, n, color )
4078 RETVAL = aapolygonColor( dst, vx, vy, n, color );
4083 GFXAapolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4093 RETVAL = aapolygonRGBA( dst, vx, vy, n, r, g, b, a );
4098 GFXFilledPolygonColor ( dst, vx, vy, n, color )
4105 RETVAL = filledPolygonColor( dst, vx, vy, n, color );
4110 GFXFilledPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4120 RETVAL = filledPolygonRGBA( dst, vx, vy, n, r, g, b, a );
4125 GFXCharacterColor ( dst, x, y, c, color )
4132 RETVAL = characterColor( dst, x, y, c, color );
4137 GFXCharacterRGBA ( dst, x, y, c, r, g, b, a )
4147 RETVAL = characterRGBA( dst, x, y, c, r, g, b, a );
4152 GFXStringColor ( dst, x, y, c, color )
4159 RETVAL = stringColor( dst, x, y, c, color );
4164 GFXStringRGBA ( dst, x, y, c, r, g, b, a )
4174 RETVAL = stringRGBA( dst, x, y, c, r, g, b, a );
4184 SVG_Load ( filename )
4187 RETVAL = SVG_Load(filename);
4192 SVG_LoadBuffer ( data, len )
4196 RETVAL = SVG_LoadBuffer(data,len);
4201 SVG_SetOffset ( source, xoff, yoff )
4202 SDL_svg_context* source
4206 RETVAL = SVG_SetOffset(source,xoff,yoff);
4211 SVG_SetScale ( source, xscale, yscale )
4212 SDL_svg_context* source
4216 RETVAL = SVG_SetScale(source,xscale,yscale);
4221 SVG_RenderToSurface ( source, x, y, dest )
4222 SDL_svg_context* source
4227 RETVAL = SVG_RenderToSurface(source,x,y,dest);
4233 SDL_svg_context* source
4238 SVG_Set_Flags ( source, flags )
4239 SDL_svg_context* source
4242 SVG_Set_Flags(source,flags);
4245 SVG_Width ( source )
4246 SDL_svg_context* source
4248 RETVAL = SVG_Width(source);
4253 SVG_HEIGHT ( source )
4254 SDL_svg_context* source
4256 RETVAL = SVG_Height(source);
4261 SVG_SetClipping ( source, minx, miny, maxx, maxy )
4262 SDL_svg_context* source
4268 SVG_SetClipping(source,minx,miny,maxx,maxy);
4273 RETVAL = SVG_Version();
4280 #ifdef HAVE_SDL_SOUND
4283 SoundAudioInfoFormat ( audioinfo )
4284 Sound_AudioInfo* audioinfo
4286 RETVAL = audioinfo->format;
4291 SoundAudioInfoChannels ( audioinfo )
4292 Sound_AudioInfo* audioinfo
4294 RETVAL = audioinfo->channels;
4299 SoundAudioInforate ( audioinfo )
4300 Sound_AudioInfo* audioinfo
4302 RETVAL = audioinfo->rate;
4307 SoundDecoderInfoExtensions ( decoderinfo )
4308 Sound_DecoderInfo* decoderinfo
4311 for ( ext = decoderinfo->extensions; *ext != NULL; ext++ ){
4312 av_push(RETVAL,newSVpv(*ext,0));
4318 SoundDecoderInfoDescription ( decoderinfo )
4319 Sound_DecoderInfo* decoderinfo
4321 RETVAL = decoderinfo->description;
4326 SoundDecoderInfoAuthor ( decoderinfo )
4327 Sound_DecoderInfo* decoderinfo
4329 RETVAL = decoderinfo->author;
4334 SoundDecoderInfoUrl ( decoderinfo )
4335 Sound_DecoderInfo* decoderinfo
4337 RETVAL = decoderinfo->url;
4341 const Sound_DecoderInfo*
4342 SoundSampleDecoder ( sample )
4343 Sound_Sample* sample
4345 RETVAL = sample->decoder;
4350 SoundSampleDesired ( sample )
4351 Sound_Sample* sample
4353 RETVAL = &sample->desired;
4358 SoundSampleAcutal ( sample )
4359 Sound_Sample* sample
4361 RETVAL = &sample->actual;
4366 SoundSampleBuffer ( sample )
4367 Sound_Sample* sample
4369 RETVAL = sample->buffer;
4374 SoundSampleBufferSize ( sample )
4375 Sound_Sample* sample
4377 RETVAL = sample->buffer_size;
4382 SoundSampleFlags ( sample )
4383 Sound_Sample* sample
4385 RETVAL = (Uint32)sample->flags;
4392 RETVAL = Sound_Init();
4399 RETVAL = Sound_Quit();
4404 Sound_AvailableDecoders ( )
4407 const Sound_DecoderInfo** sdi;
4408 sdi = Sound_AvailableDecoders();
4410 for (;*sdi != NULL; ++sdi) {
4411 av_push(RETVAL,sv_2mortal(newSViv(PTR2IV(*sdi))));
4420 RETVAL = Sound_GetError();
4425 Sound_ClearError ( )
4430 Sound_NewSample ( rw, ext, desired, buffsize )
4433 Sound_AudioInfo* desired
4436 RETVAL = Sound_NewSample(rw,ext,desired,buffsize);
4441 Sound_NewSampleFromMem ( data, size, ext, desired, buffsize )
4445 Sound_AudioInfo* desired
4448 RETVAL = Sound_NewSampleFromMem(data,size,ext,desired,buffsize);
4453 Sound_NewSampleFromFile ( fname, desired, buffsize )
4455 Sound_AudioInfo* desired
4458 RETVAL = Sound_NewSampleFromFile(fname,desired,buffsize);
4463 Sound_FreeSample ( sample )
4464 Sound_Sample* sample
4466 Sound_FreeSample(sample);
4469 Sound_GetDuration ( sample )
4470 Sound_Sample* sample
4472 RETVAL = Sound_GetDuration(sample);
4477 Sound_SetBufferSize ( sample, size )
4478 Sound_Sample* sample
4481 RETVAL = Sound_SetBufferSize(sample,size);
4486 Sound_Decode ( sample )
4487 Sound_Sample* sample
4489 RETVAL = Sound_Decode(sample);
4494 Sound_DecodeAll ( sample )
4495 Sound_Sample* sample
4497 RETVAL = Sound_DecodeAll(sample);
4502 Sound_Rewind ( sample )
4503 Sound_Sample* sample
4505 RETVAL = Sound_Rewind(sample);
4510 Sound_Seek ( sample, ms )
4511 Sound_Sample* sample
4514 RETVAL = Sound_Seek(sample,ms);
4520 MODULE = SDL PACKAGE = SDL
4521 PROTOTYPES : DISABLE