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);
862 CreateRGBSurface (flags, width, height, depth, Rmask, Gmask, Bmask, Amask )
872 RETVAL = SDL_CreateRGBSurface ( flags, width, height,
873 depth, Rmask, Gmask, Bmask, Amask );
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 );
899 #ifdef HAVE_SDL_IMAGE
905 RETVAL = IMG_Load(fname);
912 SurfaceCopy ( surface )
916 Uint32 size = surface->pitch * surface->h;
917 New(0,pixels,size,Uint8);
918 Copy(surface->pixels,pixels,size,Uint8);
919 RETVAL = SDL_CreateRGBSurfaceFrom(pixels,surface->w,surface->h,
920 surface->format->BitsPerPixel, surface->pitch,
921 surface->format->Rmask, surface->format->Gmask,
922 surface->format->Bmask, surface->format->Amask);
927 FreeSurface ( surface )
931 Uint8* pixels = surface->pixels;
932 Uint32 flags = surface->flags;
933 SDL_FreeSurface(surface);
934 if (flags & SDL_PREALLOC)
939 SurfaceFlags ( surface )
942 RETVAL = surface->flags;
947 SurfacePalette ( surface )
950 RETVAL = surface->format->palette;
955 SurfaceBitsPerPixel ( surface )
958 RETVAL = surface->format->BitsPerPixel;
963 SurfaceBytesPerPixel ( surface )
966 RETVAL = surface->format->BytesPerPixel;
971 SurfaceRshift ( surface )
974 RETVAL = surface->format->Rshift;
979 SurfaceGshift ( surface )
982 RETVAL = surface->format->Gshift;
987 SurfaceBshift ( surface )
990 RETVAL = surface->format->Bshift;
995 SurfaceAshift ( surface )
998 RETVAL = surface->format->Ashift;
1003 SurfaceRmask( surface )
1004 SDL_Surface *surface
1006 RETVAL = surface->format->Rmask;
1011 SurfaceGmask ( surface )
1012 SDL_Surface *surface
1014 RETVAL = surface->format->Gmask;
1019 SurfaceBmask ( surface )
1020 SDL_Surface *surface
1022 RETVAL = surface->format->Bmask;
1027 SurfaceAmask ( surface )
1028 SDL_Surface *surface
1030 RETVAL = surface->format->Amask;
1035 SurfaceColorKey ( surface )
1036 SDL_Surface *surface
1038 RETVAL = surface->format->colorkey;
1043 SurfaceAlpha( surface )
1044 SDL_Surface *surface
1046 RETVAL = surface->format->alpha;
1051 SurfaceW ( surface )
1052 SDL_Surface *surface
1054 RETVAL = surface->w;
1059 SurfaceH ( surface )
1060 SDL_Surface *surface
1062 RETVAL = surface->h;
1067 SurfacePitch ( surface )
1068 SDL_Surface *surface
1070 RETVAL = surface->pitch;
1075 SurfacePixels ( surface )
1076 SDL_Surface *surface
1078 RETVAL = newSVpvn(surface->pixels,surface->pitch*surface->h);
1083 SurfacePixel ( surface, x, y, ... )
1084 SDL_Surface *surface
1091 int bpp = surface->format->BytesPerPixel;
1092 Uint8* p = (Uint8*)surface->pixels + bpp*x + surface->pitch*y;
1093 if ( items < 3 || items > 4 )
1094 Perl_croak(aTHX_ "usage: SDL::SurfacePixel(surface,x,y,[color])");
1096 color = (SDL_Color*)SvIV(ST(3));
1097 pix = SDL_MapRGB(surface->format,color->r,color->g,color->b);
1106 if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
1107 p[0] = (pix >> 16) & 0xff;
1108 p[1] = (pix >> 8) & 0xff;
1112 p[1] = (pix >> 8) & 0xff;
1113 p[2] = (pix >> 16) & 0xff;
1121 RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color));
1125 memcpy(RETVAL,&surface->format->palette[index],sizeof(SDL_Color));
1129 SDL_GetRGB(pix,surface->format,&r,&g,&b);
1137 SDL_GetRGB(pix,surface->format,&r,&g,&b);
1147 MUSTLOCK ( surface )
1148 SDL_Surface *surface
1150 RETVAL = SDL_MUSTLOCK(surface);
1155 SurfaceLock ( surface )
1156 SDL_Surface *surface
1158 RETVAL = SDL_LockSurface(surface);
1163 SurfaceUnlock ( surface )
1164 SDL_Surface *surface
1166 SDL_UnlockSurface(surface);
1171 RETVAL = SDL_GetVideoSurface();
1180 SDL_VideoInfo *info;
1181 info = (SDL_VideoInfo *) safemalloc ( sizeof(SDL_VideoInfo));
1182 memcpy(info,SDL_GetVideoInfo(),sizeof(SDL_VideoInfo));
1184 hv_store(hv,"hw_available",strlen("hw_available"),
1185 newSViv(info->hw_available),0);
1186 hv_store(hv,"wm_available",strlen("wm_available"),
1187 newSViv(info->wm_available),0);
1188 hv_store(hv,"blit_hw",strlen("blit_hw"),
1189 newSViv(info->blit_hw),0);
1190 hv_store(hv,"blit_hw_CC",strlen("blit_hw_CC"),
1191 newSViv(info->blit_hw_CC),0);
1192 hv_store(hv,"blit_hw_A",strlen("blit_hw_A"),
1193 newSViv(info->blit_hw_A),0);
1194 hv_store(hv,"blit_sw",strlen("blit_sw"),
1195 newSViv(info->blit_sw),0);
1196 hv_store(hv,"blit_sw_CC",strlen("blit_sw_CC"),
1197 newSViv(info->blit_sw_CC),0);
1198 hv_store(hv,"blit_sw_A",strlen("blit_sw_A"),
1199 newSViv(info->blit_sw_A),0);
1200 hv_store(hv,"blit_fill",strlen("blit_fill"),
1201 newSViv(info->blit_fill),0);
1202 hv_store(hv,"video_mem",strlen("video_mem"),
1203 newSViv(info->video_mem),0);
1209 ListModes ( format, flags )
1211 SDL_PixelFormat *format
1215 mode = SDL_ListModes(format,flags);
1216 if (mode == (SDL_Rect**)-1 ) {
1217 av_push(RETVAL,newSVpv("all",0));
1218 } else if (! mode ) {
1219 av_push(RETVAL,newSVpv("none",0));
1221 for (;*mode;mode++) {
1222 av_push(RETVAL,newSViv(PTR2IV(*mode)));
1230 NewColor ( r, g, b )
1235 RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color));
1243 ColorR ( color, ... )
1246 if (items > 1 ) color->r = SvIV(ST(1));
1252 ColorG ( color, ... )
1255 if (items > 1 ) color->g = SvIV(ST(1));
1261 ColorB ( color, ... )
1264 if (items > 1 ) color->b = SvIV(ST(1));
1271 ColorRGB ( color, ... )
1275 color->r = SvIV(ST(1));
1276 color->g = SvIV(ST(2));
1277 color->b = SvIV(ST(3));
1279 mXPUSHi( color->r );
1280 mXPUSHi( color->g );
1281 mXPUSHi( color->b );
1288 return; safefree(color);
1291 NewPalette ( number )
1294 RETVAL = (SDL_Palette *)safemalloc(sizeof(SDL_Palette));
1295 RETVAL->colors = (SDL_Color *)safemalloc(number *
1297 RETVAL->ncolors = number;
1302 PaletteNColors ( palette, ... )
1303 SDL_Palette *palette
1305 if ( items > 1 ) palette->ncolors = SvIV(ST(1));
1306 RETVAL = palette->ncolors;
1311 PaletteColors ( palette, index, ... )
1312 SDL_Palette *palette
1316 palette->colors[index].r = SvUV(ST(2));
1317 palette->colors[index].g = SvUV(ST(3));
1318 palette->colors[index].b = SvUV(ST(4));
1320 RETVAL = (SDL_Color *)(palette->colors + index);
1325 VideoModeOK ( width, height, bpp, flags )
1331 RETVAL = SDL_VideoModeOK(width,height,bpp,flags);
1336 SetVideoMode ( width, height, bpp, flags )
1342 RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
1347 UpdateRect ( surface, x, y, w ,h )
1348 SDL_Surface *surface
1354 SDL_UpdateRect(surface,x,y,w,h);
1357 UpdateRects ( surface, ... )
1358 SDL_Surface *surface
1360 SDL_Rect *rects, *temp;
1362 if ( items < 2 ) return;
1363 num_rects = items - 1;
1365 rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
1366 for(i=0;i<num_rects;i++) {
1367 temp = (SDL_Rect *)SvIV(ST(i+1));
1368 rects[i].x = temp->x;
1369 rects[i].y = temp->y;
1370 rects[i].w = temp->w;
1371 rects[i].h = temp->h;
1373 SDL_UpdateRects(surface,num_rects,rects);
1379 SDL_Surface *surface
1381 RETVAL = SDL_Flip(surface);
1386 SetColors ( surface, start, ... )
1387 SDL_Surface *surface
1390 SDL_Color *colors,*temp;
1392 if ( items < 3 ) { RETVAL = 0; goto all_done; }
1394 colors = (SDL_Color *)safemalloc(sizeof(SDL_Color)*(length+1));
1395 for ( i = 0; i < length ; i++ ) {
1396 temp = (SDL_Color *)SvIV(ST(i+2));
1397 colors[i].r = temp->r;
1398 colors[i].g = temp->g;
1399 colors[i].b = temp->b;
1401 RETVAL = SDL_SetColors(surface, colors, start, length );
1408 MapRGB ( surface, r, g, b )
1409 SDL_Surface *surface
1414 RETVAL = SDL_MapRGB(surface->format,r,g,b);
1419 MapRGBA ( surface, r, g, b, a )
1420 SDL_Surface *surface
1426 RETVAL = SDL_MapRGBA(surface->format,r,g,b,a);
1431 GetRGB ( surface, pixel )
1432 SDL_Surface *surface
1436 SDL_GetRGB(pixel,surface->format,&r,&g,&b);
1438 av_push(RETVAL,newSViv(r));
1439 av_push(RETVAL,newSViv(g));
1440 av_push(RETVAL,newSViv(b));
1445 GetRGBA ( surface, pixel )
1446 SDL_Surface *surface
1450 SDL_GetRGBA(pixel,surface->format,&r,&g,&b,&a);
1452 av_push(RETVAL,newSViv(r));
1453 av_push(RETVAL,newSViv(g));
1454 av_push(RETVAL,newSViv(b));
1455 av_push(RETVAL,newSViv(a));
1460 SaveBMP ( surface, filename )
1461 SDL_Surface *surface
1464 RETVAL = SDL_SaveBMP(surface,filename);
1469 SetColorKey ( surface, flag, key )
1470 SDL_Surface *surface
1474 Uint32 pixel = SDL_MapRGB(surface->format,key->r,key->g,key->b);
1475 RETVAL = SDL_SetColorKey(surface,flag,pixel);
1480 SetAlpha ( surface, flag, alpha )
1481 SDL_Surface *surface
1485 RETVAL = SDL_SetAlpha(surface,flag,alpha);
1490 DisplayFormat ( surface )
1491 SDL_Surface *surface
1493 RETVAL = SDL_DisplayFormat(surface);
1498 DisplayFormatAlpha ( surface )
1499 SDL_Surface *surface
1501 RETVAL = SDL_DisplayFormatAlpha(surface);
1506 ConvertRGB ( surface )
1507 SDL_Surface * surface
1509 SDL_PixelFormat fmt;
1511 fmt.BitsPerPixel = 24;
1512 fmt.BytesPerPixel = 3;
1513 fmt.Rmask = 0x000000ff;
1514 fmt.Gmask = 0x0000ff00;
1515 fmt.Bmask = 0x00ff0000;
1516 fmt.Amask = 0x00000000;
1527 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1532 ConvertRGBA ( surface )
1533 SDL_Surface * surface
1535 SDL_PixelFormat fmt;
1537 fmt.BitsPerPixel = 32;
1538 fmt.BytesPerPixel = 4;
1539 fmt.Rmask = 0x000000ff;
1540 fmt.Gmask = 0x0000ff00;
1541 fmt.Bmask = 0x00ff0000;
1542 fmt.Amask = 0xff000000;
1553 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1558 BlitSurface ( src, src_rect, dest, dest_rect )
1567 RETVAL = SDL_BlitSurface(src,src_rect,dest,dest_rect);
1572 FillRect ( dest, dest_rect, color )
1580 Uint32 pixel = SDL_MapRGB(dest->format,color->r,color->g,color->b);
1581 RETVAL = SDL_FillRect(dest,dest_rect,pixel);
1588 RETVAL = SDL_GetAppState();
1594 WMSetCaption ( title, icon )
1598 SDL_WM_SetCaption(title,icon);
1604 SDL_WM_GetCaption(&title,&icon);
1606 av_push(RETVAL,newSVpv(title,0));
1607 av_push(RETVAL,newSVpv(icon,0));
1615 SDL_WM_SetIcon(icon,NULL);
1630 mask = SDL_GetMouseState(&x,&y);
1632 av_push(RETVAL,newSViv(mask));
1633 av_push(RETVAL,newSViv(x));
1634 av_push(RETVAL,newSViv(y));
1639 GetRelativeMouseState ()
1644 mask = SDL_GetRelativeMouseState(&x,&y);
1646 av_push(RETVAL,newSViv(mask));
1647 av_push(RETVAL,newSViv(x));
1648 av_push(RETVAL,newSViv(y));
1653 NewCursor ( data, mask, x ,y )
1659 RETVAL = SDL_CreateCursor((Uint8*)data->pixels,
1660 (Uint8*)mask->pixels,data->w,data->h,x,y);
1665 FreeCursor ( cursor )
1668 SDL_FreeCursor(cursor);
1671 SetCursor ( cursor )
1674 SDL_SetCursor(cursor);
1679 RETVAL = SDL_GetCursor();
1684 ShowCursor ( toggle )
1687 RETVAL = SDL_ShowCursor(toggle);
1692 NewAudioSpec ( freq, format, channels, samples )
1698 RETVAL = (SDL_AudioSpec *)safemalloc(sizeof(SDL_AudioSpec));
1699 RETVAL->freq = freq;
1700 RETVAL->format = format;
1701 RETVAL->channels = channels;
1702 RETVAL->samples = samples;
1707 FreeAudioSpec ( spec )
1713 NewAudioCVT ( src_format, src_channels, src_rate, dst_format, dst_channels, dst_rate)
1721 RETVAL = (SDL_AudioCVT *)safemalloc(sizeof(SDL_AudioCVT));
1722 if (SDL_BuildAudioCVT(RETVAL,src_format, src_channels, src_rate,
1723 dst_format, dst_channels, dst_rate)) {
1724 safefree(RETVAL); RETVAL = NULL; }
1729 FreeAudioCVT ( cvt )
1735 ConvertAudioData ( cvt, data, len )
1741 cvt->buf = (Uint8*) safemalloc(cvt->len*cvt->len_mult);
1742 memcpy(cvt->buf,data,cvt->len);
1743 RETVAL = SDL_ConvertAudio(cvt);
1748 OpenAudio ( spec, callback )
1752 spec->userdata = (void*)callback;
1753 spec->callback = sdl_perl_audio_callback;
1754 RETVAL = SDL_OpenAudio(spec,NULL);
1761 RETVAL = SDL_GetAudioStatus ();
1769 SDL_PauseAudio(p_on);
1793 LoadWAV ( filename, spec )
1797 SDL_AudioSpec *temp;
1802 temp = SDL_LoadWAV(filename,spec,&buf,&len);
1803 if ( ! temp ) goto error;
1804 av_push(RETVAL,newSViv(PTR2IV(temp)));
1805 av_push(RETVAL,newSViv(PTR2IV(buf)));
1806 av_push(RETVAL,newSViv(len));
1811 #ifdef HAVE_SDL_MIXER
1814 MixAudio ( dst, src, len, volume )
1820 SDL_MixAudio(dst,src,len,volume);
1823 MixOpenAudio ( frequency, format, channels, chunksize )
1829 RETVAL = Mix_OpenAudio(frequency, format, channels, chunksize);
1834 MixAllocateChannels ( number )
1837 RETVAL = Mix_AllocateChannels(number);
1844 int freq, channels, status;
1846 status = Mix_QuerySpec(&freq,&format,&channels);
1848 av_push(RETVAL,newSViv(status));
1849 av_push(RETVAL,newSViv(freq));
1850 av_push(RETVAL,newSViv(format));
1851 av_push(RETVAL,newSViv(channels));
1856 MixLoadWAV ( filename )
1859 RETVAL = Mix_LoadWAV(filename);
1864 MixLoadMusic ( filename )
1867 RETVAL = Mix_LoadMUS(filename);
1872 MixQuickLoadWAV ( buf )
1875 RETVAL = Mix_QuickLoad_WAV(buf);
1880 MixFreeChunk( chunk )
1883 Mix_FreeChunk(chunk);
1886 MixFreeMusic ( music )
1889 Mix_FreeMusic(music);
1892 MixSetPostMixCallback ( func, arg )
1896 Mix_SetPostMix(func,arg);
1901 RETVAL = sdl_perl_music_callback;
1906 MixSetMusicHook ( func, arg )
1910 Mix_HookMusic(func,arg);
1913 MixSetMusicFinishedHook ( func )
1916 mix_music_finished_cv = func;
1917 Mix_HookMusicFinished(sdl_perl_music_finished_callback);
1920 MixGetMusicHookData ()
1922 RETVAL = Mix_GetMusicHookData();
1927 MixReverseChannels ( number )
1930 RETVAL = Mix_ReserveChannels ( number );
1935 MixGroupChannel ( which, tag )
1939 RETVAL = Mix_GroupChannel(which,tag);
1944 MixGroupChannels ( from, to, tag )
1949 RETVAL = Mix_GroupChannels(from,to,tag);
1954 MixGroupAvailable ( tag )
1957 RETVAL = Mix_GroupAvailable(tag);
1962 MixGroupCount ( tag )
1965 RETVAL = Mix_GroupCount(tag);
1970 MixGroupOldest ( tag )
1973 RETVAL = Mix_GroupOldest(tag);
1978 MixGroupNewer ( tag )
1981 RETVAL = Mix_GroupNewer(tag);
1986 MixPlayChannel ( channel, chunk, loops )
1991 RETVAL = Mix_PlayChannel(channel,chunk,loops);
1996 MixPlayChannelTimed ( channel, chunk, loops, ticks )
2002 RETVAL = Mix_PlayChannelTimed(channel,chunk,loops,ticks);
2007 MixPlayMusic ( music, loops )
2011 RETVAL = Mix_PlayMusic(music,loops);
2016 MixFadeInChannel ( channel, chunk, loops, ms )
2022 RETVAL = Mix_FadeInChannel(channel,chunk,loops,ms);
2027 MixFadeInChannelTimed ( channel, chunk, loops, ms, ticks )
2034 RETVAL = Mix_FadeInChannelTimed(channel,chunk,loops,ms,ticks);
2039 MixFadeInMusic ( music, loops, ms )
2044 RETVAL = Mix_FadeInMusic(music,loops,ms);
2049 MixVolume ( channel, volume )
2053 RETVAL = Mix_Volume(channel,volume);
2058 MixVolumeChunk ( chunk, volume )
2062 RETVAL = Mix_VolumeChunk(chunk,volume);
2067 MixVolumeMusic ( volume )
2070 RETVAL = Mix_VolumeMusic(volume);
2075 MixHaltChannel ( channel )
2078 RETVAL = Mix_HaltChannel(channel);
2083 MixHaltGroup ( tag )
2086 RETVAL = Mix_HaltGroup(tag);
2093 RETVAL = Mix_HaltMusic();
2098 MixExpireChannel ( channel, ticks )
2102 RETVAL = Mix_ExpireChannel ( channel,ticks);
2107 MixFadeOutChannel ( which, ms )
2111 RETVAL = Mix_FadeOutChannel(which,ms);
2116 MixFadeOutGroup ( which, ms )
2120 RETVAL = Mix_FadeOutGroup(which,ms);
2125 MixFadeOutMusic ( ms )
2128 RETVAL = Mix_FadeOutMusic(ms);
2135 RETVAL = Mix_FadingMusic();
2140 MixFadingChannel( which )
2143 RETVAL = Mix_FadingChannel(which);
2148 MixPause ( channel )
2154 MixResume ( channel )
2157 Mix_Resume(channel);
2160 MixPaused ( channel )
2163 RETVAL = Mix_Paused(channel);
2185 RETVAL = Mix_PausedMusic();
2190 MixPlaying( channel )
2193 RETVAL = Mix_Playing(channel);
2200 RETVAL = Mix_PlayingMusic();
2213 GLLoadLibrary ( path )
2216 RETVAL = SDL_GL_LoadLibrary(path);
2221 GLGetProcAddress ( proc )
2224 RETVAL = SDL_GL_GetProcAddress(proc);
2229 GLSetAttribute ( attr, value )
2233 RETVAL = SDL_GL_SetAttribute(attr, value);
2238 GLGetAttribute ( attr )
2243 av_push(RETVAL,newSViv(SDL_GL_GetAttribute(attr, &value)));
2244 av_push(RETVAL,newSViv(value));
2251 SDL_GL_SwapBuffers ();
2257 RETVAL = (SDL_BYTEORDER == SDL_BIG_ENDIAN);
2264 RETVAL = SDL_NumJoysticks();
2269 JoystickName ( index )
2272 RETVAL = (char*)SDL_JoystickName(index);
2277 JoystickOpen ( index )
2280 RETVAL = SDL_JoystickOpen(index);
2285 JoystickOpened ( index )
2288 RETVAL = SDL_JoystickOpened(index);
2293 JoystickIndex ( joystick )
2294 SDL_Joystick *joystick
2296 RETVAL = SDL_JoystickIndex(joystick);
2301 JoystickNumAxes ( joystick )
2302 SDL_Joystick *joystick
2304 RETVAL = SDL_JoystickNumAxes(joystick);
2309 JoystickNumBalls ( joystick )
2310 SDL_Joystick *joystick
2312 RETVAL = SDL_JoystickNumBalls(joystick);
2317 JoystickNumHats ( joystick )
2318 SDL_Joystick *joystick
2320 RETVAL = SDL_JoystickNumHats(joystick);
2325 JoystickNumButtons ( joystick )
2326 SDL_Joystick *joystick
2328 RETVAL = SDL_JoystickNumButtons(joystick);
2335 SDL_JoystickUpdate();
2338 JoystickGetAxis ( joystick, axis )
2339 SDL_Joystick *joystick
2342 RETVAL = SDL_JoystickGetAxis(joystick,axis);
2347 JoystickGetHat ( joystick, hat )
2348 SDL_Joystick *joystick
2351 RETVAL = SDL_JoystickGetHat(joystick,hat);
2356 JoystickGetButton ( joystick, button)
2357 SDL_Joystick *joystick
2360 RETVAL = SDL_JoystickGetButton(joystick,button);
2365 JoystickGetBall ( joystick, ball )
2366 SDL_Joystick *joystick
2370 success = SDL_JoystickGetBall(joystick,ball,&dx,&dy);
2372 av_push(RETVAL,newSViv(success));
2373 av_push(RETVAL,newSViv(dx));
2374 av_push(RETVAL,newSViv(dy));
2379 JoystickClose ( joystick )
2380 SDL_Joystick *joystick
2382 SDL_JoystickClose(joystick);
2385 JoyAxisEventWhich ( e )
2388 RETVAL = e->jaxis.which;
2393 JoyAxisEventAxis ( e )
2396 RETVAL = e->jaxis.axis;
2401 JoyAxisEventValue ( e )
2404 RETVAL = e->jaxis.value;
2409 JoyButtonEventWhich ( e )
2412 RETVAL = e->jbutton.which;
2417 JoyButtonEventButton ( e )
2420 RETVAL = e->jbutton.button;
2425 JoyButtonEventState ( e )
2428 RETVAL = e->jbutton.state;
2433 JoyHatEventWhich ( e )
2436 RETVAL = e->jhat.which;
2441 JoyHatEventHat ( e )
2444 RETVAL = e->jhat.hat;
2449 JoyHatEventValue ( e )
2452 RETVAL = e->jhat.value;
2457 JoyBallEventWhich ( e )
2460 RETVAL = e->jball.which;
2465 JoyBallEventBall ( e )
2468 RETVAL = e->jball.ball;
2473 JoyBallEventXrel ( e )
2476 RETVAL = e->jball.xrel;
2481 JoyBallEventYrel ( e )
2484 RETVAL = e->jball.yrel;
2489 SetClipRect ( surface, rect )
2490 SDL_Surface *surface
2493 SDL_SetClipRect(surface,rect);
2496 GetClipRect ( surface, rect )
2497 SDL_Surface *surface
2500 SDL_GetClipRect(surface, rect);
2508 RETVAL = SDLNet_Init();
2518 NetNewIPaddress ( host, port )
2522 RETVAL = (IPaddress*) safemalloc(sizeof(IPaddress));
2523 RETVAL->host = host;
2524 RETVAL->port = port;
2529 NetIPaddressHost ( ip )
2537 NetIPaddressPort ( ip )
2545 NetFreeIPaddress ( ip )
2551 NetResolveIP ( address )
2554 RETVAL = SDLNet_ResolveIP(address);
2559 NetResolveHost ( address, host, port )
2564 RETVAL = SDLNet_ResolveHost(address,host,port);
2572 RETVAL = SDLNet_TCP_Open(ip);
2577 NetTCPAccept ( server )
2580 RETVAL = SDLNet_TCP_Accept(server);
2585 NetTCPGetPeerAddress ( sock )
2588 RETVAL = SDLNet_TCP_GetPeerAddress(sock);
2593 NetTCPSend ( sock, data, len )
2598 RETVAL = SDLNet_TCP_Send(sock,data,len);
2603 NetTCPRecv ( sock, maxlen )
2609 buffer = safemalloc(maxlen);
2611 status = SDLNet_TCP_Recv(sock,buffer,maxlen);
2612 av_push(RETVAL,newSViv(status));
2613 av_push(RETVAL,newSVpvn((char*)buffer,maxlen));
2618 NetTCPClose ( sock )
2621 SDLNet_TCP_Close(sock);
2624 NetAllocPacket ( size )
2627 RETVAL = SDLNet_AllocPacket(size);
2632 NetAllocPacketV ( howmany, size )
2636 RETVAL = SDLNet_AllocPacketV(howmany,size);
2641 NetResizePacket ( packet, newsize )
2645 RETVAL = SDLNet_ResizePacket(packet,newsize);
2650 NetFreePacket ( packet )
2653 SDLNet_FreePacket(packet);
2656 NetFreePacketV ( packet )
2659 SDLNet_FreePacketV(packet);
2665 RETVAL = SDLNet_UDP_Open(port);
2670 NetUDPBind ( sock, channel, address )
2675 RETVAL = SDLNet_UDP_Bind(sock,channel,address);
2680 NetUDPUnbind ( sock, channel )
2684 SDLNet_UDP_Unbind(sock,channel);
2687 NetUDPGetPeerAddress ( sock, channel )
2691 RETVAL = SDLNet_UDP_GetPeerAddress(sock,channel);
2696 NetUDPSendV ( sock, packets, npackets )
2701 RETVAL = SDLNet_UDP_SendV(sock,packets,npackets);
2706 NetUDPSend ( sock, channel, packet )
2711 RETVAL = SDLNet_UDP_Send(sock,channel,packet);
2716 NetUDPRecvV ( sock, packets )
2720 RETVAL = SDLNet_UDP_RecvV(sock,packets);
2725 NetUDPRecv ( sock, packet )
2729 RETVAL = SDLNet_UDP_Recv(sock,packet);
2734 NetUDPClose ( sock )
2737 SDLNet_UDP_Close(sock);
2740 NetAllocSocketSet ( maxsockets )
2743 RETVAL = SDLNet_AllocSocketSet(maxsockets);
2748 NetTCP_AddSocket ( set, sock )
2749 SDLNet_SocketSet set
2752 RETVAL = SDLNet_TCP_AddSocket(set,sock);
2757 NetUDP_AddSocket ( set, sock )
2758 SDLNet_SocketSet set
2761 RETVAL = SDLNet_UDP_AddSocket(set,sock);
2766 NetTCP_DelSocket ( set, sock )
2767 SDLNet_SocketSet set
2770 RETVAL = SDLNet_TCP_DelSocket(set,sock);
2775 NetUDP_DelSocket ( set, sock )
2776 SDLNet_SocketSet set
2779 RETVAL = SDLNet_UDP_DelSocket(set,sock);
2784 NetCheckSockets ( set, timeout )
2785 SDLNet_SocketSet set
2788 RETVAL = SDLNet_CheckSockets(set,timeout);
2793 NetSocketReady ( sock )
2794 SDLNet_GenericSocket sock
2796 RETVAL = SDLNet_SocketReady(sock);
2801 NetFreeSocketSet ( set )
2802 SDLNet_SocketSet set
2804 SDLNet_FreeSocketSet(set);
2807 NetWrite16 ( value, area )
2811 SDLNet_Write16(value,area);
2814 NetWrite32 ( value, area )
2818 SDLNet_Write32(value,area);
2824 RETVAL = SDLNet_Read16(area);
2832 RETVAL = SDLNet_Read32(area);
2843 RETVAL = TTF_Init();
2853 TTFOpenFont ( file, ptsize )
2857 RETVAL = TTF_OpenFont(file,ptsize);
2862 TTFGetFontStyle ( font )
2865 RETVAL = TTF_GetFontStyle(font);
2870 TTFSetFontStyle ( font, style )
2874 TTF_SetFontStyle(font,style);
2877 TTFFontHeight ( font )
2880 RETVAL = TTF_FontHeight(font);
2885 TTFFontAscent ( font )
2888 RETVAL = TTF_FontAscent(font);
2893 TTFFontDescent ( font )
2896 RETVAL = TTF_FontDescent(font);
2901 TTFFontLineSkip ( font )
2904 RETVAL = TTF_FontLineSkip(font);
2909 TTFGlyphMetrics ( font, ch )
2913 int minx, miny, maxx, maxy, advance;
2915 TTF_GlyphMetrics(font, ch, &minx, &miny, &maxx, &maxy, &advance);
2916 av_push(RETVAL,newSViv(minx));
2917 av_push(RETVAL,newSViv(miny));
2918 av_push(RETVAL,newSViv(maxx));
2919 av_push(RETVAL,newSViv(maxy));
2920 av_push(RETVAL,newSViv(advance));
2925 TTFSizeText ( font, text )
2931 if(TTF_SizeText(font,text,&w,&h))
2933 printf("TTF error at TTFSizeText: %s \n", TTF_GetError());
2934 Perl_croak (aTHX_ "TTF error \n");
2938 av_push(RETVAL,newSViv(w));
2939 av_push(RETVAL,newSViv(h));
2940 sv_2mortal((SV*)RETVAL);
2948 TTFSizeUTF8 ( font, text )
2954 if(TTF_SizeUTF8(font,text,&w,&h))
2956 av_push(RETVAL,newSViv(w));
2957 av_push(RETVAL,newSViv(h));
2958 sv_2mortal((SV*)RETVAL);
2963 printf("TTF error at TTFSizeUTF8 with : %s \n", TTF_GetError());
2964 Perl_croak (aTHX_ "TTF error \n");
2971 TTFSizeUNICODE ( font, text )
2977 if(TTF_SizeUNICODE(font,text,&w,&h))
2979 av_push(RETVAL,newSViv(w));
2980 av_push(RETVAL,newSViv(h));
2981 sv_2mortal((SV*)RETVAL);
2986 printf("TTF error at TTFSizeUNICODE : %s \n", TTF_GetError());
2987 Perl_croak (aTHX_ "TTF error \n");
2994 TTFRenderTextSolid ( font, text, fg )
2999 RETVAL = TTF_RenderText_Solid(font,text,*fg);
3004 TTFRenderUTF8Solid ( font, text, fg )
3009 RETVAL = TTF_RenderUTF8_Solid(font,text,*fg);
3014 TTFRenderUNICODESolid ( font, text, fg )
3019 RETVAL = TTF_RenderUNICODE_Solid(font,text,*fg);
3024 TTFRenderGlyphSolid ( font, ch, fg )
3029 RETVAL = TTF_RenderGlyph_Solid(font,ch,*fg);
3034 TTFRenderTextShaded ( font, text, fg, bg )
3040 RETVAL = TTF_RenderText_Shaded(font,text,*fg,*bg);
3045 TTFRenderUTF8Shaded( font, text, fg, bg )
3051 RETVAL = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3056 TTFRenderUNICODEShaded( font, text, fg, bg )
3062 RETVAL = TTF_RenderUNICODE_Shaded(font,text,*fg,*bg);
3067 TTFRenderGlyphShaded ( font, ch, fg, bg )
3073 RETVAL = TTF_RenderGlyph_Shaded(font,ch,*fg,*bg);
3078 TTFRenderTextBlended( font, text, fg )
3083 RETVAL = TTF_RenderText_Blended(font,text,*fg);
3088 TTFRenderUTF8Blended( font, text, fg )
3093 RETVAL = TTF_RenderUTF8_Blended(font,text,*fg);
3098 TTFRenderUNICODEBlended( font, text, fg )
3103 RETVAL = TTF_RenderUNICODE_Blended(font,text,*fg);
3108 TTFRenderGlyphBlended( font, ch, fg )
3113 RETVAL = TTF_RenderGlyph_Blended(font,ch,*fg);
3118 TTFCloseFont ( font )
3121 TTF_CloseFont(font);
3122 font=NULL; //to be safe http://sdl.beuc.net/sdl.wiki/SDL_ttf_copy_Functions_Management_TTF_CloseFont
3125 TTFPutString ( font, mode, surface, x, y, fg, bg, text )
3128 SDL_Surface *surface
3143 img = TTF_RenderText_Solid(font,text,*fg);
3144 TTF_SizeText(font,text,&w,&h);
3149 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3150 TTF_SizeText(font,text,&w,&h);
3155 img = TTF_RenderText_Blended(font,text,*fg);
3156 TTF_SizeText(font,text,&w,&h);
3161 img = TTF_RenderUTF8_Solid(font,text,*fg);
3162 TTF_SizeUTF8(font,text,&w,&h);
3167 img = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3168 TTF_SizeUTF8(font,text,&w,&h);
3173 img = TTF_RenderUTF8_Blended(font,text,*fg);
3174 TTF_SizeUTF8(font,text,&w,&h);
3179 img = TTF_RenderUNICODE_Solid(font,(Uint16*)text,*fg);
3180 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3184 case UNICODE_SHADED:
3185 img = TTF_RenderUNICODE_Shaded(font,(Uint16*)text,*fg,*bg);
3186 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3190 case UNICODE_BLENDED:
3191 img = TTF_RenderUNICODE_Blended(font,(Uint16*)text,*fg);
3192 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3197 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3198 TTF_SizeText(font,text,&w,&h);
3202 if ( img && img->format && img->format->palette ) {
3203 SDL_Color *c = &img->format->palette->colors[0];
3204 Uint32 key = SDL_MapRGB( img->format, c->r, c->g, c->b );
3205 SDL_SetColorKey(img,SDL_SRCCOLORKEY,key );
3206 if (0 > SDL_BlitSurface(img,NULL,surface,&dest)) {
3207 SDL_FreeSurface(img);
3219 CreateYUVOverlay ( width, height, format, display )
3223 SDL_Surface *display
3225 RETVAL = SDL_CreateYUVOverlay ( width, height, format, display );
3230 LockYUVOverlay ( overlay )
3231 SDL_Overlay *overlay
3233 RETVAL = SDL_LockYUVOverlay(overlay);
3238 UnlockYUVOverlay ( overlay )
3239 SDL_Overlay *overlay
3241 SDL_UnlockYUVOverlay(overlay);
3244 DisplayYUVOverlay ( overlay, dstrect )
3245 SDL_Overlay *overlay
3248 RETVAL = SDL_DisplayYUVOverlay ( overlay, dstrect );
3253 FreeYUVOverlay ( overlay )
3254 SDL_Overlay *overlay
3256 SDL_FreeYUVOverlay ( overlay );
3259 OverlayFormat ( overlay, ... )
3260 SDL_Overlay *overlay
3263 overlay->format = SvIV(ST(1));
3264 RETVAL = overlay->format;
3269 OverlayW ( overlay, ... )
3270 SDL_Overlay *overlay
3273 overlay->w = SvIV(ST(1));
3274 RETVAL = overlay->w;
3279 OverlayH ( overlay, ... )
3280 SDL_Overlay *overlay
3283 overlay->h = SvIV(ST(1));
3284 RETVAL = overlay->h;
3289 OverlayPlanes ( overlay, ... )
3290 SDL_Overlay *overlay
3293 overlay->planes = SvIV(ST(1));
3294 RETVAL = overlay->planes;
3299 OverlayHW ( overlay )
3300 SDL_Overlay *overlay
3302 RETVAL = overlay->hw_overlay;
3307 OverlayPitches ( overlay )
3308 SDL_Overlay *overlay
3310 RETVAL = overlay->pitches;
3315 OverlayPixels ( overlay )
3316 SDL_Overlay *overlay
3318 RETVAL = overlay->pixels;
3323 WMToggleFullScreen ( surface )
3324 SDL_Surface *surface
3326 RETVAL = SDL_WM_ToggleFullScreen(surface);
3331 WMGrabInput ( mode )
3334 RETVAL = SDL_WM_GrabInput(mode);
3341 RETVAL = SDL_WM_IconifyWindow();
3349 RETVAL = e->resize.w;
3357 RETVAL = e->resize.h;
3365 RETVAL = SDL_AudioDriverName(name,32);
3373 if (k >= SDLK_LAST) Perl_croak (aTHX_ "Key out of range");
3374 RETVAL = SDL_GetKeyState(NULL)[k];
3383 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3388 FreeSMPEGInfo ( info )
3394 SMPEGInfoHasAudio ( info )
3397 RETVAL = info->has_audio;
3402 SMPEGInfoHasVideo ( info )
3405 RETVAL = info->has_video;
3410 SMPEGInfoWidth ( info )
3413 RETVAL = info->width;
3418 SMPEGInfoHeight ( info )
3421 RETVAL = info->height;
3426 SMPEGInfoCurrentFrame ( info )
3429 RETVAL = info->current_frame;
3434 SMPEGInfoCurrentFPS ( info )
3437 RETVAL = info->current_fps;
3442 SMPEGInfoCurrentAudioFrame ( info )
3445 RETVAL = info->audio_current_frame;
3450 SMPEGInfoCurrentOffset ( info )
3453 RETVAL = info->current_offset;
3458 SMPEGInfoTotalSize ( info )
3461 RETVAL = info->total_size;
3466 SMPEGInfoCurrentTime ( info )
3469 RETVAL = info->current_time;
3474 SMPEGInfoTotalTime ( info )
3477 RETVAL = info->total_time;
3485 RETVAL = SMPEG_error(mpeg);
3490 NewSMPEG ( filename, info, use_audio )
3495 #ifdef HAVE_SDL_MIXER
3496 RETVAL = SMPEG_new(filename,info,0);
3498 RETVAL = SMPEG_new(filename,info,use_audio);
3510 SMPEGEnableAudio ( mpeg , flag )
3514 SMPEG_enableaudio(mpeg,flag);
3515 #ifdef HAVE_SDL_MIXER
3516 sdl_perl_use_smpeg_audio = flag;
3520 SMPEGEnableVideo ( mpeg , flag )
3524 SMPEG_enablevideo(mpeg,flag);
3527 SMPEGSetVolume ( mpeg , volume )
3531 SMPEG_setvolume(mpeg,volume);
3534 SMPEGSetDisplay ( mpeg, dest, surfLock )
3539 SMPEG_setdisplay(mpeg,dest,surfLock,NULL);
3542 SMPEGScaleXY ( mpeg, w, h)
3547 SMPEG_scaleXY(mpeg,w,h);
3550 SMPEGScale ( mpeg, scale )
3554 SMPEG_scale(mpeg,scale);
3560 SDL_AudioSpec audiofmt;
3563 #ifdef HAVE_SDL_MIXER
3564 if (sdl_perl_use_smpeg_audio ) {
3565 SMPEG_enableaudio(mpeg, 0);
3566 Mix_QuerySpec(&freq, &format, &channels);
3567 audiofmt.format = format;
3568 audiofmt.freq = freq;
3569 audiofmt.channels = channels;
3570 SMPEG_actualSpec(mpeg, &audiofmt);
3571 Mix_HookMusic(SMPEG_playAudioSDL, mpeg);
3572 SMPEG_enableaudio(mpeg, 1);
3578 SMPEGStatus ( mpeg )
3581 RETVAL = SMPEG_status(mpeg);
3592 SMPEGLoop ( mpeg, repeat )
3596 SMPEG_loop(mpeg,repeat);
3603 #ifdef HAVE_SDL_MIXER
3604 Mix_HookMusic(NULL, NULL);
3608 SMPEGRewind ( mpeg )
3614 SMPEGSeek ( mpeg, bytes )
3618 SMPEG_seek(mpeg,bytes);
3621 SMPEGSkip ( mpeg, seconds )
3625 SMPEG_skip(mpeg,seconds);
3628 SMPEGSetDisplayRegion ( mpeg, rect )
3632 SMPEG_setdisplayregion(mpeg,rect->x,rect->y,rect->w,rect->h);
3635 SMPEGRenderFrame ( mpeg, frame )
3639 SMPEG_renderFrame(mpeg,frame);
3642 SMPEGGetInfo ( mpeg )
3645 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3646 SMPEG_getinfo(mpeg,RETVAL);
3656 GFXRotoZoom ( src, angle, zoom, smooth)
3662 RETVAL = rotozoomSurface( src, angle, zoom, smooth);
3667 GFXZoom ( src, zoomx, zoomy, smooth)
3673 RETVAL = zoomSurface( src, zoomx, zoomy, smooth);
3678 GFXPixelColor ( dst, x, y, color )
3684 RETVAL = pixelColor( dst, x, y, color);
3689 GFXPixelRGBA ( dst, x, y, r, g, b, a )
3698 RETVAL = pixelRGBA( dst, x, y, r, g, b, a );
3703 GFXHlineColor ( dst, x1, x2, y, color )
3710 RETVAL = hlineColor( dst, x1, x2, y, color );
3715 GFXHlineRGBA ( dst, x1, x2, y, r, g, b, a )
3725 RETVAL = hlineRGBA( dst, x1, x2, y, r, g, b, a );
3730 GFXVlineColor ( dst, x, y1, y2, color )
3737 RETVAL = vlineColor( dst, x, y1, y2, color );
3742 GFXVlineRGBA ( dst, x, y1, y2, r, g, b, a )
3752 RETVAL = vlineRGBA( dst, x, y1, y2, r, g, b, a );
3757 GFXRectangleColor ( dst, x1, y1, x2, y2, color )
3765 RETVAL = rectangleColor( dst, x1, y1, x2, y2, color );
3770 GFXRectangleRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3781 RETVAL = rectangleRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3786 GFXBoxColor ( dst, x1, y1, x2, y2, color )
3794 RETVAL = boxColor( dst, x1, y1, x2, y2, color );
3799 GFXBoxRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3810 RETVAL = boxRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3815 GFXLineColor ( dst, x1, y1, x2, y2, color )
3823 RETVAL = lineColor( dst, x1, y1, x2, y2, color );
3828 GFXLineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3839 RETVAL = lineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3844 GFXAalineColor ( dst, x1, y1, x2, y2, color )
3852 RETVAL = aalineColor( dst, x1, y1, x2, y2, color );
3857 GFXAalineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3868 RETVAL = aalineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3873 GFXCircleColor ( dst, x, y, r, color )
3880 RETVAL = circleColor( dst, x, y, r, color );
3885 GFXCircleRGBA ( dst, x, y, rad, r, g, b, a )
3895 RETVAL = circleRGBA( dst, x, y, rad, r, g, b, a );
3900 GFXAacircleColor ( dst, x, y, r, color )
3907 RETVAL = aacircleColor( dst, x, y, r, color );
3912 GFXAacircleRGBA ( dst, x, y, rad, r, g, b, a )
3922 RETVAL = aacircleRGBA( dst, x, y, rad, r, g, b, a );
3927 GFXFilledCircleColor ( dst, x, y, r, color )
3934 RETVAL = filledCircleColor( dst, x, y, r, color );
3939 GFXFilledCircleRGBA ( dst, x, y, rad, r, g, b, a )
3949 RETVAL = filledCircleRGBA( dst, x, y, rad, r, g, b, a );
3954 GFXEllipseColor ( dst, x, y, rx, ry, color )
3962 RETVAL = ellipseColor( dst, x, y, rx, ry, color );
3967 GFXEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
3978 RETVAL = ellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
3983 GFXAaellipseColor ( dst, xc, yc, rx, ry, color )
3991 RETVAL = aaellipseColor( dst, xc, yc, rx, ry, color );
3996 GFXAaellipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
4007 RETVAL = aaellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
4012 GFXFilledEllipseColor ( dst, x, y, rx, ry, color )
4020 RETVAL = filledEllipseColor( dst, x, y, rx, ry, color );
4025 GFXFilledEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
4036 RETVAL = filledEllipseRGBA( dst, x, y, rx, ry, r, g, b, a );
4041 GFXFilledPieColor ( dst, x, y, rad, start, end, color )
4050 RETVAL = filledPieColor( dst, x, y, rad, start, end, color );
4055 GFXFilledPieRGBA ( dst, x, y, rad, start, end, r, g, b, a )
4067 RETVAL = filledPieRGBA( dst, x, y, rad, start, end, r, g, b, a );
4072 GFXPolygonColor ( dst, vx, vy, n, color )
4079 RETVAL = polygonColor( dst, vx, vy, n, color );
4084 GFXPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4094 RETVAL = polygonRGBA( dst, vx, vy, n, r, g, b, a );
4099 GFXAapolygonColor ( dst, vx, vy, n, color )
4106 RETVAL = aapolygonColor( dst, vx, vy, n, color );
4111 GFXAapolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4121 RETVAL = aapolygonRGBA( dst, vx, vy, n, r, g, b, a );
4126 GFXFilledPolygonColor ( dst, vx, vy, n, color )
4133 RETVAL = filledPolygonColor( dst, vx, vy, n, color );
4138 GFXFilledPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4148 RETVAL = filledPolygonRGBA( dst, vx, vy, n, r, g, b, a );
4153 GFXCharacterColor ( dst, x, y, c, color )
4160 RETVAL = characterColor( dst, x, y, c, color );
4165 GFXCharacterRGBA ( dst, x, y, c, r, g, b, a )
4175 RETVAL = characterRGBA( dst, x, y, c, r, g, b, a );
4180 GFXStringColor ( dst, x, y, c, color )
4187 RETVAL = stringColor( dst, x, y, c, color );
4192 GFXStringRGBA ( dst, x, y, c, r, g, b, a )
4202 RETVAL = stringRGBA( dst, x, y, c, r, g, b, a );
4212 SVG_Load ( filename )
4215 RETVAL = SVG_Load(filename);
4220 SVG_LoadBuffer ( data, len )
4224 RETVAL = SVG_LoadBuffer(data,len);
4229 SVG_SetOffset ( source, xoff, yoff )
4230 SDL_svg_context* source
4234 RETVAL = SVG_SetOffset(source,xoff,yoff);
4239 SVG_SetScale ( source, xscale, yscale )
4240 SDL_svg_context* source
4244 RETVAL = SVG_SetScale(source,xscale,yscale);
4249 SVG_RenderToSurface ( source, x, y, dest )
4250 SDL_svg_context* source
4255 RETVAL = SVG_RenderToSurface(source,x,y,dest);
4261 SDL_svg_context* source
4266 SVG_Set_Flags ( source, flags )
4267 SDL_svg_context* source
4270 SVG_Set_Flags(source,flags);
4273 SVG_Width ( source )
4274 SDL_svg_context* source
4276 RETVAL = SVG_Width(source);
4281 SVG_HEIGHT ( source )
4282 SDL_svg_context* source
4284 RETVAL = SVG_Height(source);
4289 SVG_SetClipping ( source, minx, miny, maxx, maxy )
4290 SDL_svg_context* source
4296 SVG_SetClipping(source,minx,miny,maxx,maxy);
4301 RETVAL = SVG_Version();
4308 #ifdef HAVE_SDL_SOUND
4311 SoundAudioInfoFormat ( audioinfo )
4312 Sound_AudioInfo* audioinfo
4314 RETVAL = audioinfo->format;
4319 SoundAudioInfoChannels ( audioinfo )
4320 Sound_AudioInfo* audioinfo
4322 RETVAL = audioinfo->channels;
4327 SoundAudioInforate ( audioinfo )
4328 Sound_AudioInfo* audioinfo
4330 RETVAL = audioinfo->rate;
4335 SoundDecoderInfoExtensions ( decoderinfo )
4336 Sound_DecoderInfo* decoderinfo
4339 for ( ext = decoderinfo->extensions; *ext != NULL; ext++ ){
4340 av_push(RETVAL,newSVpv(*ext,0));
4346 SoundDecoderInfoDescription ( decoderinfo )
4347 Sound_DecoderInfo* decoderinfo
4349 RETVAL = decoderinfo->description;
4354 SoundDecoderInfoAuthor ( decoderinfo )
4355 Sound_DecoderInfo* decoderinfo
4357 RETVAL = decoderinfo->author;
4362 SoundDecoderInfoUrl ( decoderinfo )
4363 Sound_DecoderInfo* decoderinfo
4365 RETVAL = decoderinfo->url;
4369 const Sound_DecoderInfo*
4370 SoundSampleDecoder ( sample )
4371 Sound_Sample* sample
4373 RETVAL = sample->decoder;
4378 SoundSampleDesired ( sample )
4379 Sound_Sample* sample
4381 RETVAL = &sample->desired;
4386 SoundSampleAcutal ( sample )
4387 Sound_Sample* sample
4389 RETVAL = &sample->actual;
4394 SoundSampleBuffer ( sample )
4395 Sound_Sample* sample
4397 RETVAL = sample->buffer;
4402 SoundSampleBufferSize ( sample )
4403 Sound_Sample* sample
4405 RETVAL = sample->buffer_size;
4410 SoundSampleFlags ( sample )
4411 Sound_Sample* sample
4413 RETVAL = (Uint32)sample->flags;
4420 RETVAL = Sound_Init();
4427 RETVAL = Sound_Quit();
4432 Sound_AvailableDecoders ( )
4435 const Sound_DecoderInfo** sdi;
4436 sdi = Sound_AvailableDecoders();
4438 for (;*sdi != NULL; ++sdi) {
4439 av_push(RETVAL,sv_2mortal(newSViv(PTR2IV(*sdi))));
4448 RETVAL = Sound_GetError();
4453 Sound_ClearError ( )
4458 Sound_NewSample ( rw, ext, desired, buffsize )
4461 Sound_AudioInfo* desired
4464 RETVAL = Sound_NewSample(rw,ext,desired,buffsize);
4469 Sound_NewSampleFromMem ( data, size, ext, desired, buffsize )
4473 Sound_AudioInfo* desired
4476 RETVAL = Sound_NewSampleFromMem(data,size,ext,desired,buffsize);
4481 Sound_NewSampleFromFile ( fname, desired, buffsize )
4483 Sound_AudioInfo* desired
4486 RETVAL = Sound_NewSampleFromFile(fname,desired,buffsize);
4491 Sound_FreeSample ( sample )
4492 Sound_Sample* sample
4494 Sound_FreeSample(sample);
4497 Sound_GetDuration ( sample )
4498 Sound_Sample* sample
4500 RETVAL = Sound_GetDuration(sample);
4505 Sound_SetBufferSize ( sample, size )
4506 Sound_Sample* sample
4509 RETVAL = Sound_SetBufferSize(sample,size);
4514 Sound_Decode ( sample )
4515 Sound_Sample* sample
4517 RETVAL = Sound_Decode(sample);
4522 Sound_DecodeAll ( sample )
4523 Sound_Sample* sample
4525 RETVAL = Sound_DecodeAll(sample);
4530 Sound_Rewind ( sample )
4531 Sound_Sample* sample
4533 RETVAL = Sound_Rewind(sample);
4538 Sound_Seek ( sample, ms )
4539 Sound_Sample* sample
4542 RETVAL = Sound_Seek(sample,ms);
4548 MODULE = SDL PACKAGE = SDL
4549 PROTOTYPES : DISABLE