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 NewRect ( x, y, w, h )
1215 RETVAL = (SDL_Rect *) safemalloc (sizeof(SDL_Rect));
1233 if (items > 1 ) rect->x = SvIV(ST(1));
1242 if (items > 1 ) rect->y = SvIV(ST(1));
1251 if (items > 1 ) rect->w = SvIV(ST(1));
1260 if (items > 1 ) rect->h = SvIV(ST(1));
1266 ListModes ( format, flags )
1268 SDL_PixelFormat *format
1272 mode = SDL_ListModes(format,flags);
1273 if (mode == (SDL_Rect**)-1 ) {
1274 av_push(RETVAL,newSVpv("all",0));
1275 } else if (! mode ) {
1276 av_push(RETVAL,newSVpv("none",0));
1278 for (;*mode;mode++) {
1279 av_push(RETVAL,newSViv(PTR2IV(*mode)));
1287 NewColor ( r, g, b )
1292 RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color));
1300 ColorR ( color, ... )
1303 if (items > 1 ) color->r = SvIV(ST(1));
1309 ColorG ( color, ... )
1312 if (items > 1 ) color->g = SvIV(ST(1));
1318 ColorB ( color, ... )
1321 if (items > 1 ) color->b = SvIV(ST(1));
1328 ColorRGB ( color, ... )
1332 color->r = SvIV(ST(1));
1333 color->g = SvIV(ST(2));
1334 color->b = SvIV(ST(3));
1336 mXPUSHi( color->r );
1337 mXPUSHi( color->g );
1338 mXPUSHi( color->b );
1345 return; safefree(color);
1348 NewPalette ( number )
1351 RETVAL = (SDL_Palette *)safemalloc(sizeof(SDL_Palette));
1352 RETVAL->colors = (SDL_Color *)safemalloc(number *
1354 RETVAL->ncolors = number;
1359 PaletteNColors ( palette, ... )
1360 SDL_Palette *palette
1362 if ( items > 1 ) palette->ncolors = SvIV(ST(1));
1363 RETVAL = palette->ncolors;
1368 PaletteColors ( palette, index, ... )
1369 SDL_Palette *palette
1373 palette->colors[index].r = SvUV(ST(2));
1374 palette->colors[index].g = SvUV(ST(3));
1375 palette->colors[index].b = SvUV(ST(4));
1377 RETVAL = (SDL_Color *)(palette->colors + index);
1382 VideoModeOK ( width, height, bpp, flags )
1388 RETVAL = SDL_VideoModeOK(width,height,bpp,flags);
1393 SetVideoMode ( width, height, bpp, flags )
1399 RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
1404 UpdateRect ( surface, x, y, w ,h )
1405 SDL_Surface *surface
1411 SDL_UpdateRect(surface,x,y,w,h);
1414 UpdateRects ( surface, ... )
1415 SDL_Surface *surface
1417 SDL_Rect *rects, *temp;
1419 if ( items < 2 ) return;
1420 num_rects = items - 1;
1421 rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
1422 for(i=0;i<num_rects;i++) {
1423 temp = (SDL_Rect *)SvIV(ST(i+1));
1424 rects[i].x = temp->x;
1425 rects[i].y = temp->y;
1426 rects[i].w = temp->w;
1427 rects[i].h = temp->h;
1429 SDL_UpdateRects(surface,num_rects,rects);
1434 SDL_Surface *surface
1436 RETVAL = SDL_Flip(surface);
1441 SetColors ( surface, start, ... )
1442 SDL_Surface *surface
1445 SDL_Color *colors,*temp;
1447 if ( items < 3 ) { RETVAL = 0; goto all_done; }
1449 colors = (SDL_Color *)safemalloc(sizeof(SDL_Color)*(length+1));
1450 for ( i = 0; i < length ; i++ ) {
1451 temp = (SDL_Color *)SvIV(ST(i+2));
1452 colors[i].r = temp->r;
1453 colors[i].g = temp->g;
1454 colors[i].b = temp->b;
1456 RETVAL = SDL_SetColors(surface, colors, start, length );
1463 MapRGB ( surface, r, g, b )
1464 SDL_Surface *surface
1469 RETVAL = SDL_MapRGB(surface->format,r,g,b);
1474 MapRGBA ( surface, r, g, b, a )
1475 SDL_Surface *surface
1481 RETVAL = SDL_MapRGBA(surface->format,r,g,b,a);
1486 GetRGB ( surface, pixel )
1487 SDL_Surface *surface
1491 SDL_GetRGB(pixel,surface->format,&r,&g,&b);
1493 av_push(RETVAL,newSViv(r));
1494 av_push(RETVAL,newSViv(g));
1495 av_push(RETVAL,newSViv(b));
1500 GetRGBA ( surface, pixel )
1501 SDL_Surface *surface
1505 SDL_GetRGBA(pixel,surface->format,&r,&g,&b,&a);
1507 av_push(RETVAL,newSViv(r));
1508 av_push(RETVAL,newSViv(g));
1509 av_push(RETVAL,newSViv(b));
1510 av_push(RETVAL,newSViv(a));
1515 SaveBMP ( surface, filename )
1516 SDL_Surface *surface
1519 RETVAL = SDL_SaveBMP(surface,filename);
1524 SetColorKey ( surface, flag, key )
1525 SDL_Surface *surface
1529 Uint32 pixel = SDL_MapRGB(surface->format,key->r,key->g,key->b);
1530 RETVAL = SDL_SetColorKey(surface,flag,pixel);
1535 SetAlpha ( surface, flag, alpha )
1536 SDL_Surface *surface
1540 RETVAL = SDL_SetAlpha(surface,flag,alpha);
1545 DisplayFormat ( surface )
1546 SDL_Surface *surface
1548 RETVAL = SDL_DisplayFormat(surface);
1553 DisplayFormatAlpha ( surface )
1554 SDL_Surface *surface
1556 RETVAL = SDL_DisplayFormatAlpha(surface);
1561 ConvertRGB ( surface )
1562 SDL_Surface * surface
1564 SDL_PixelFormat fmt;
1566 fmt.BitsPerPixel = 24;
1567 fmt.BytesPerPixel = 3;
1568 fmt.Rmask = 0x000000ff;
1569 fmt.Gmask = 0x0000ff00;
1570 fmt.Bmask = 0x00ff0000;
1571 fmt.Amask = 0x00000000;
1582 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1587 ConvertRGBA ( surface )
1588 SDL_Surface * surface
1590 SDL_PixelFormat fmt;
1592 fmt.BitsPerPixel = 32;
1593 fmt.BytesPerPixel = 4;
1594 fmt.Rmask = 0x000000ff;
1595 fmt.Gmask = 0x0000ff00;
1596 fmt.Bmask = 0x00ff0000;
1597 fmt.Amask = 0xff000000;
1608 RETVAL = SDL_ConvertSurface(surface,&fmt,surface->flags);
1613 BlitSurface ( src, src_rect, dest, dest_rect )
1619 RETVAL = SDL_BlitSurface(src,src_rect,dest,dest_rect);
1624 FillRect ( dest, dest_rect, color )
1629 Uint32 pixel = SDL_MapRGB(dest->format,color->r,color->g,color->b);
1630 RETVAL = SDL_FillRect(dest,dest_rect,pixel);
1637 RETVAL = SDL_GetAppState();
1643 WMSetCaption ( title, icon )
1647 SDL_WM_SetCaption(title,icon);
1653 SDL_WM_GetCaption(&title,&icon);
1655 av_push(RETVAL,newSVpv(title,0));
1656 av_push(RETVAL,newSVpv(icon,0));
1664 SDL_WM_SetIcon(icon,NULL);
1679 mask = SDL_GetMouseState(&x,&y);
1681 av_push(RETVAL,newSViv(mask));
1682 av_push(RETVAL,newSViv(x));
1683 av_push(RETVAL,newSViv(y));
1688 GetRelativeMouseState ()
1693 mask = SDL_GetRelativeMouseState(&x,&y);
1695 av_push(RETVAL,newSViv(mask));
1696 av_push(RETVAL,newSViv(x));
1697 av_push(RETVAL,newSViv(y));
1702 NewCursor ( data, mask, x ,y )
1708 RETVAL = SDL_CreateCursor((Uint8*)data->pixels,
1709 (Uint8*)mask->pixels,data->w,data->h,x,y);
1714 FreeCursor ( cursor )
1717 SDL_FreeCursor(cursor);
1720 SetCursor ( cursor )
1723 SDL_SetCursor(cursor);
1728 RETVAL = SDL_GetCursor();
1733 ShowCursor ( toggle )
1736 RETVAL = SDL_ShowCursor(toggle);
1741 NewAudioSpec ( freq, format, channels, samples )
1747 RETVAL = (SDL_AudioSpec *)safemalloc(sizeof(SDL_AudioSpec));
1748 RETVAL->freq = freq;
1749 RETVAL->format = format;
1750 RETVAL->channels = channels;
1751 RETVAL->samples = samples;
1756 FreeAudioSpec ( spec )
1762 NewAudioCVT ( src_format, src_channels, src_rate, dst_format, dst_channels, dst_rate)
1770 RETVAL = (SDL_AudioCVT *)safemalloc(sizeof(SDL_AudioCVT));
1771 if (SDL_BuildAudioCVT(RETVAL,src_format, src_channels, src_rate,
1772 dst_format, dst_channels, dst_rate)) {
1773 safefree(RETVAL); RETVAL = NULL; }
1778 FreeAudioCVT ( cvt )
1784 ConvertAudioData ( cvt, data, len )
1790 cvt->buf = (Uint8*) safemalloc(cvt->len*cvt->len_mult);
1791 memcpy(cvt->buf,data,cvt->len);
1792 RETVAL = SDL_ConvertAudio(cvt);
1797 OpenAudio ( spec, callback )
1801 spec->userdata = (void*)callback;
1802 spec->callback = sdl_perl_audio_callback;
1803 RETVAL = SDL_OpenAudio(spec,NULL);
1810 RETVAL = SDL_GetAudioStatus ();
1818 SDL_PauseAudio(p_on);
1842 LoadWAV ( filename, spec )
1846 SDL_AudioSpec *temp;
1851 temp = SDL_LoadWAV(filename,spec,&buf,&len);
1852 if ( ! temp ) goto error;
1853 av_push(RETVAL,newSViv(PTR2IV(temp)));
1854 av_push(RETVAL,newSViv(PTR2IV(buf)));
1855 av_push(RETVAL,newSViv(len));
1860 #ifdef HAVE_SDL_MIXER
1863 MixAudio ( dst, src, len, volume )
1869 SDL_MixAudio(dst,src,len,volume);
1872 MixOpenAudio ( frequency, format, channels, chunksize )
1878 RETVAL = Mix_OpenAudio(frequency, format, channels, chunksize);
1883 MixAllocateChannels ( number )
1886 RETVAL = Mix_AllocateChannels(number);
1893 int freq, channels, status;
1895 status = Mix_QuerySpec(&freq,&format,&channels);
1897 av_push(RETVAL,newSViv(status));
1898 av_push(RETVAL,newSViv(freq));
1899 av_push(RETVAL,newSViv(format));
1900 av_push(RETVAL,newSViv(channels));
1905 MixLoadWAV ( filename )
1908 RETVAL = Mix_LoadWAV(filename);
1913 MixLoadMusic ( filename )
1916 RETVAL = Mix_LoadMUS(filename);
1921 MixQuickLoadWAV ( buf )
1924 RETVAL = Mix_QuickLoad_WAV(buf);
1929 MixFreeChunk( chunk )
1932 Mix_FreeChunk(chunk);
1935 MixFreeMusic ( music )
1938 Mix_FreeMusic(music);
1941 MixSetPostMixCallback ( func, arg )
1945 Mix_SetPostMix(func,arg);
1950 RETVAL = sdl_perl_music_callback;
1955 MixSetMusicHook ( func, arg )
1959 Mix_HookMusic(func,arg);
1962 MixSetMusicFinishedHook ( func )
1965 mix_music_finished_cv = func;
1966 Mix_HookMusicFinished(sdl_perl_music_finished_callback);
1969 MixGetMusicHookData ()
1971 RETVAL = Mix_GetMusicHookData();
1976 MixReverseChannels ( number )
1979 RETVAL = Mix_ReserveChannels ( number );
1984 MixGroupChannel ( which, tag )
1988 RETVAL = Mix_GroupChannel(which,tag);
1993 MixGroupChannels ( from, to, tag )
1998 RETVAL = Mix_GroupChannels(from,to,tag);
2003 MixGroupAvailable ( tag )
2006 RETVAL = Mix_GroupAvailable(tag);
2011 MixGroupCount ( tag )
2014 RETVAL = Mix_GroupCount(tag);
2019 MixGroupOldest ( tag )
2022 RETVAL = Mix_GroupOldest(tag);
2027 MixGroupNewer ( tag )
2030 RETVAL = Mix_GroupNewer(tag);
2035 MixPlayChannel ( channel, chunk, loops )
2040 RETVAL = Mix_PlayChannel(channel,chunk,loops);
2045 MixPlayChannelTimed ( channel, chunk, loops, ticks )
2051 RETVAL = Mix_PlayChannelTimed(channel,chunk,loops,ticks);
2056 MixPlayMusic ( music, loops )
2060 RETVAL = Mix_PlayMusic(music,loops);
2065 MixFadeInChannel ( channel, chunk, loops, ms )
2071 RETVAL = Mix_FadeInChannel(channel,chunk,loops,ms);
2076 MixFadeInChannelTimed ( channel, chunk, loops, ms, ticks )
2083 RETVAL = Mix_FadeInChannelTimed(channel,chunk,loops,ms,ticks);
2088 MixFadeInMusic ( music, loops, ms )
2093 RETVAL = Mix_FadeInMusic(music,loops,ms);
2098 MixVolume ( channel, volume )
2102 RETVAL = Mix_Volume(channel,volume);
2107 MixVolumeChunk ( chunk, volume )
2111 RETVAL = Mix_VolumeChunk(chunk,volume);
2116 MixVolumeMusic ( volume )
2119 RETVAL = Mix_VolumeMusic(volume);
2124 MixHaltChannel ( channel )
2127 RETVAL = Mix_HaltChannel(channel);
2132 MixHaltGroup ( tag )
2135 RETVAL = Mix_HaltGroup(tag);
2142 RETVAL = Mix_HaltMusic();
2147 MixExpireChannel ( channel, ticks )
2151 RETVAL = Mix_ExpireChannel ( channel,ticks);
2156 MixFadeOutChannel ( which, ms )
2160 RETVAL = Mix_FadeOutChannel(which,ms);
2165 MixFadeOutGroup ( which, ms )
2169 RETVAL = Mix_FadeOutGroup(which,ms);
2174 MixFadeOutMusic ( ms )
2177 RETVAL = Mix_FadeOutMusic(ms);
2184 RETVAL = Mix_FadingMusic();
2189 MixFadingChannel( which )
2192 RETVAL = Mix_FadingChannel(which);
2197 MixPause ( channel )
2203 MixResume ( channel )
2206 Mix_Resume(channel);
2209 MixPaused ( channel )
2212 RETVAL = Mix_Paused(channel);
2234 RETVAL = Mix_PausedMusic();
2239 MixPlaying( channel )
2242 RETVAL = Mix_Playing(channel);
2249 RETVAL = Mix_PlayingMusic();
2262 GLLoadLibrary ( path )
2265 RETVAL = SDL_GL_LoadLibrary(path);
2270 GLGetProcAddress ( proc )
2273 RETVAL = SDL_GL_GetProcAddress(proc);
2278 GLSetAttribute ( attr, value )
2282 RETVAL = SDL_GL_SetAttribute(attr, value);
2287 GLGetAttribute ( attr )
2292 av_push(RETVAL,newSViv(SDL_GL_GetAttribute(attr, &value)));
2293 av_push(RETVAL,newSViv(value));
2300 SDL_GL_SwapBuffers ();
2306 RETVAL = (SDL_BYTEORDER == SDL_BIG_ENDIAN);
2313 RETVAL = SDL_NumJoysticks();
2318 JoystickName ( index )
2321 RETVAL = (char*)SDL_JoystickName(index);
2326 JoystickOpen ( index )
2329 RETVAL = SDL_JoystickOpen(index);
2334 JoystickOpened ( index )
2337 RETVAL = SDL_JoystickOpened(index);
2342 JoystickIndex ( joystick )
2343 SDL_Joystick *joystick
2345 RETVAL = SDL_JoystickIndex(joystick);
2350 JoystickNumAxes ( joystick )
2351 SDL_Joystick *joystick
2353 RETVAL = SDL_JoystickNumAxes(joystick);
2358 JoystickNumBalls ( joystick )
2359 SDL_Joystick *joystick
2361 RETVAL = SDL_JoystickNumBalls(joystick);
2366 JoystickNumHats ( joystick )
2367 SDL_Joystick *joystick
2369 RETVAL = SDL_JoystickNumHats(joystick);
2374 JoystickNumButtons ( joystick )
2375 SDL_Joystick *joystick
2377 RETVAL = SDL_JoystickNumButtons(joystick);
2384 SDL_JoystickUpdate();
2387 JoystickGetAxis ( joystick, axis )
2388 SDL_Joystick *joystick
2391 RETVAL = SDL_JoystickGetAxis(joystick,axis);
2396 JoystickGetHat ( joystick, hat )
2397 SDL_Joystick *joystick
2400 RETVAL = SDL_JoystickGetHat(joystick,hat);
2405 JoystickGetButton ( joystick, button)
2406 SDL_Joystick *joystick
2409 RETVAL = SDL_JoystickGetButton(joystick,button);
2414 JoystickGetBall ( joystick, ball )
2415 SDL_Joystick *joystick
2419 success = SDL_JoystickGetBall(joystick,ball,&dx,&dy);
2421 av_push(RETVAL,newSViv(success));
2422 av_push(RETVAL,newSViv(dx));
2423 av_push(RETVAL,newSViv(dy));
2428 JoystickClose ( joystick )
2429 SDL_Joystick *joystick
2431 SDL_JoystickClose(joystick);
2434 JoyAxisEventWhich ( e )
2437 RETVAL = e->jaxis.which;
2442 JoyAxisEventAxis ( e )
2445 RETVAL = e->jaxis.axis;
2450 JoyAxisEventValue ( e )
2453 RETVAL = e->jaxis.value;
2458 JoyButtonEventWhich ( e )
2461 RETVAL = e->jbutton.which;
2466 JoyButtonEventButton ( e )
2469 RETVAL = e->jbutton.button;
2474 JoyButtonEventState ( e )
2477 RETVAL = e->jbutton.state;
2482 JoyHatEventWhich ( e )
2485 RETVAL = e->jhat.which;
2490 JoyHatEventHat ( e )
2493 RETVAL = e->jhat.hat;
2498 JoyHatEventValue ( e )
2501 RETVAL = e->jhat.value;
2506 JoyBallEventWhich ( e )
2509 RETVAL = e->jball.which;
2514 JoyBallEventBall ( e )
2517 RETVAL = e->jball.ball;
2522 JoyBallEventXrel ( e )
2525 RETVAL = e->jball.xrel;
2530 JoyBallEventYrel ( e )
2533 RETVAL = e->jball.yrel;
2538 SetClipRect ( surface, rect )
2539 SDL_Surface *surface
2542 SDL_SetClipRect(surface,rect);
2545 GetClipRect ( surface )
2546 SDL_Surface *surface
2548 RETVAL = (SDL_Rect*) safemalloc(sizeof(SDL_Rect));
2549 SDL_GetClipRect(surface,RETVAL);
2559 RETVAL = SDLNet_Init();
2569 NetNewIPaddress ( host, port )
2573 RETVAL = (IPaddress*) safemalloc(sizeof(IPaddress));
2574 RETVAL->host = host;
2575 RETVAL->port = port;
2580 NetIPaddressHost ( ip )
2588 NetIPaddressPort ( ip )
2596 NetFreeIPaddress ( ip )
2602 NetResolveIP ( address )
2605 RETVAL = SDLNet_ResolveIP(address);
2610 NetResolveHost ( address, host, port )
2615 RETVAL = SDLNet_ResolveHost(address,host,port);
2623 RETVAL = SDLNet_TCP_Open(ip);
2628 NetTCPAccept ( server )
2631 RETVAL = SDLNet_TCP_Accept(server);
2636 NetTCPGetPeerAddress ( sock )
2639 RETVAL = SDLNet_TCP_GetPeerAddress(sock);
2644 NetTCPSend ( sock, data, len )
2649 RETVAL = SDLNet_TCP_Send(sock,data,len);
2654 NetTCPRecv ( sock, maxlen )
2660 buffer = safemalloc(maxlen);
2662 status = SDLNet_TCP_Recv(sock,buffer,maxlen);
2663 av_push(RETVAL,newSViv(status));
2664 av_push(RETVAL,newSVpvn((char*)buffer,maxlen));
2669 NetTCPClose ( sock )
2672 SDLNet_TCP_Close(sock);
2675 NetAllocPacket ( size )
2678 RETVAL = SDLNet_AllocPacket(size);
2683 NetAllocPacketV ( howmany, size )
2687 RETVAL = SDLNet_AllocPacketV(howmany,size);
2692 NetResizePacket ( packet, newsize )
2696 RETVAL = SDLNet_ResizePacket(packet,newsize);
2701 NetFreePacket ( packet )
2704 SDLNet_FreePacket(packet);
2707 NetFreePacketV ( packet )
2710 SDLNet_FreePacketV(packet);
2716 RETVAL = SDLNet_UDP_Open(port);
2721 NetUDPBind ( sock, channel, address )
2726 RETVAL = SDLNet_UDP_Bind(sock,channel,address);
2731 NetUDPUnbind ( sock, channel )
2735 SDLNet_UDP_Unbind(sock,channel);
2738 NetUDPGetPeerAddress ( sock, channel )
2742 RETVAL = SDLNet_UDP_GetPeerAddress(sock,channel);
2747 NetUDPSendV ( sock, packets, npackets )
2752 RETVAL = SDLNet_UDP_SendV(sock,packets,npackets);
2757 NetUDPSend ( sock, channel, packet )
2762 RETVAL = SDLNet_UDP_Send(sock,channel,packet);
2767 NetUDPRecvV ( sock, packets )
2771 RETVAL = SDLNet_UDP_RecvV(sock,packets);
2776 NetUDPRecv ( sock, packet )
2780 RETVAL = SDLNet_UDP_Recv(sock,packet);
2785 NetUDPClose ( sock )
2788 SDLNet_UDP_Close(sock);
2791 NetAllocSocketSet ( maxsockets )
2794 RETVAL = SDLNet_AllocSocketSet(maxsockets);
2799 NetTCP_AddSocket ( set, sock )
2800 SDLNet_SocketSet set
2803 RETVAL = SDLNet_TCP_AddSocket(set,sock);
2808 NetUDP_AddSocket ( set, sock )
2809 SDLNet_SocketSet set
2812 RETVAL = SDLNet_UDP_AddSocket(set,sock);
2817 NetTCP_DelSocket ( set, sock )
2818 SDLNet_SocketSet set
2821 RETVAL = SDLNet_TCP_DelSocket(set,sock);
2826 NetUDP_DelSocket ( set, sock )
2827 SDLNet_SocketSet set
2830 RETVAL = SDLNet_UDP_DelSocket(set,sock);
2835 NetCheckSockets ( set, timeout )
2836 SDLNet_SocketSet set
2839 RETVAL = SDLNet_CheckSockets(set,timeout);
2844 NetSocketReady ( sock )
2845 SDLNet_GenericSocket sock
2847 RETVAL = SDLNet_SocketReady(sock);
2852 NetFreeSocketSet ( set )
2853 SDLNet_SocketSet set
2855 SDLNet_FreeSocketSet(set);
2858 NetWrite16 ( value, area )
2862 SDLNet_Write16(value,area);
2865 NetWrite32 ( value, area )
2869 SDLNet_Write32(value,area);
2875 RETVAL = SDLNet_Read16(area);
2883 RETVAL = SDLNet_Read32(area);
2894 RETVAL = TTF_Init();
2904 TTFOpenFont ( file, ptsize )
2908 RETVAL = TTF_OpenFont(file,ptsize);
2913 TTFGetFontStyle ( font )
2916 RETVAL = TTF_GetFontStyle(font);
2921 TTFSetFontStyle ( font, style )
2925 TTF_SetFontStyle(font,style);
2928 TTFFontHeight ( font )
2931 RETVAL = TTF_FontHeight(font);
2936 TTFFontAscent ( font )
2939 RETVAL = TTF_FontAscent(font);
2944 TTFFontDescent ( font )
2947 RETVAL = TTF_FontDescent(font);
2952 TTFFontLineSkip ( font )
2955 RETVAL = TTF_FontLineSkip(font);
2960 TTFGlyphMetrics ( font, ch )
2964 int minx, miny, maxx, maxy, advance;
2966 TTF_GlyphMetrics(font, ch, &minx, &miny, &maxx, &maxy, &advance);
2967 av_push(RETVAL,newSViv(minx));
2968 av_push(RETVAL,newSViv(miny));
2969 av_push(RETVAL,newSViv(maxx));
2970 av_push(RETVAL,newSViv(maxy));
2971 av_push(RETVAL,newSViv(advance));
2976 TTFSizeText ( font, text )
2982 if(TTF_SizeText(font,text,&w,&h))
2984 av_push(RETVAL,newSViv(w));
2985 av_push(RETVAL,newSViv(h));
2986 sv_2mortal((SV*)RETVAL);
2990 printf("TTF error at TTFSizeText: %s \n", TTF_GetError());
2991 Perl_croak (aTHX_ "TTF error \n");
3000 TTFSizeUTF8 ( font, text )
3006 if(TTF_SizeUTF8(font,text,&w,&h))
3008 av_push(RETVAL,newSViv(w));
3009 av_push(RETVAL,newSViv(h));
3010 sv_2mortal((SV*)RETVAL);
3015 printf("TTF error at TTFSizeUTF8 with : %s \n", TTF_GetError());
3016 Perl_croak (aTHX_ "TTF error \n");
3023 TTFSizeUNICODE ( font, text )
3029 if(TTF_SizeUNICODE(font,text,&w,&h))
3031 av_push(RETVAL,newSViv(w));
3032 av_push(RETVAL,newSViv(h));
3033 sv_2mortal((SV*)RETVAL);
3038 printf("TTF error at TTFSizeUNICODE : %s \n", TTF_GetError());
3039 Perl_croak (aTHX_ "TTF error \n");
3046 TTFRenderTextSolid ( font, text, fg )
3051 RETVAL = TTF_RenderText_Solid(font,text,*fg);
3056 TTFRenderUTF8Solid ( font, text, fg )
3061 RETVAL = TTF_RenderUTF8_Solid(font,text,*fg);
3066 TTFRenderUNICODESolid ( font, text, fg )
3071 RETVAL = TTF_RenderUNICODE_Solid(font,text,*fg);
3076 TTFRenderGlyphSolid ( font, ch, fg )
3081 RETVAL = TTF_RenderGlyph_Solid(font,ch,*fg);
3086 TTFRenderTextShaded ( font, text, fg, bg )
3092 RETVAL = TTF_RenderText_Shaded(font,text,*fg,*bg);
3097 TTFRenderUTF8Shaded( font, text, fg, bg )
3103 RETVAL = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3108 TTFRenderUNICODEShaded( font, text, fg, bg )
3114 RETVAL = TTF_RenderUNICODE_Shaded(font,text,*fg,*bg);
3119 TTFRenderGlyphShaded ( font, ch, fg, bg )
3125 RETVAL = TTF_RenderGlyph_Shaded(font,ch,*fg,*bg);
3130 TTFRenderTextBlended( font, text, fg )
3135 RETVAL = TTF_RenderText_Blended(font,text,*fg);
3140 TTFRenderUTF8Blended( font, text, fg )
3145 RETVAL = TTF_RenderUTF8_Blended(font,text,*fg);
3150 TTFRenderUNICODEBlended( font, text, fg )
3155 RETVAL = TTF_RenderUNICODE_Blended(font,text,*fg);
3160 TTFRenderGlyphBlended( font, ch, fg )
3165 RETVAL = TTF_RenderGlyph_Blended(font,ch,*fg);
3170 TTFCloseFont ( font )
3173 TTF_CloseFont(font);
3174 font=NULL; //to be safe http://sdl.beuc.net/sdl.wiki/SDL_ttf_copy_Functions_Management_TTF_CloseFont
3177 TTFPutString ( font, mode, surface, x, y, fg, bg, text )
3180 SDL_Surface *surface
3195 img = TTF_RenderText_Solid(font,text,*fg);
3196 TTF_SizeText(font,text,&w,&h);
3201 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3202 TTF_SizeText(font,text,&w,&h);
3207 img = TTF_RenderText_Blended(font,text,*fg);
3208 TTF_SizeText(font,text,&w,&h);
3213 img = TTF_RenderUTF8_Solid(font,text,*fg);
3214 TTF_SizeUTF8(font,text,&w,&h);
3219 img = TTF_RenderUTF8_Shaded(font,text,*fg,*bg);
3220 TTF_SizeUTF8(font,text,&w,&h);
3225 img = TTF_RenderUTF8_Blended(font,text,*fg);
3226 TTF_SizeUTF8(font,text,&w,&h);
3231 img = TTF_RenderUNICODE_Solid(font,(Uint16*)text,*fg);
3232 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3236 case UNICODE_SHADED:
3237 img = TTF_RenderUNICODE_Shaded(font,(Uint16*)text,*fg,*bg);
3238 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3242 case UNICODE_BLENDED:
3243 img = TTF_RenderUNICODE_Blended(font,(Uint16*)text,*fg);
3244 TTF_SizeUNICODE(font,(Uint16*)text,&w,&h);
3249 img = TTF_RenderText_Shaded(font,text,*fg,*bg);
3250 TTF_SizeText(font,text,&w,&h);
3254 if ( img && img->format && img->format->palette ) {
3255 SDL_Color *c = &img->format->palette->colors[0];
3256 Uint32 key = SDL_MapRGB( img->format, c->r, c->g, c->b );
3257 SDL_SetColorKey(img,SDL_SRCCOLORKEY,key );
3258 if (0 > SDL_BlitSurface(img,NULL,surface,&dest)) {
3259 SDL_FreeSurface(img);
3271 CreateYUVOverlay ( width, height, format, display )
3275 SDL_Surface *display
3277 RETVAL = SDL_CreateYUVOverlay ( width, height, format, display );
3282 LockYUVOverlay ( overlay )
3283 SDL_Overlay *overlay
3285 RETVAL = SDL_LockYUVOverlay(overlay);
3290 UnlockYUVOverlay ( overlay )
3291 SDL_Overlay *overlay
3293 SDL_UnlockYUVOverlay(overlay);
3296 DisplayYUVOverlay ( overlay, dstrect )
3297 SDL_Overlay *overlay
3300 RETVAL = SDL_DisplayYUVOverlay ( overlay, dstrect );
3305 FreeYUVOverlay ( overlay )
3306 SDL_Overlay *overlay
3308 SDL_FreeYUVOverlay ( overlay );
3311 OverlayFormat ( overlay, ... )
3312 SDL_Overlay *overlay
3315 overlay->format = SvIV(ST(1));
3316 RETVAL = overlay->format;
3321 OverlayW ( overlay, ... )
3322 SDL_Overlay *overlay
3325 overlay->w = SvIV(ST(1));
3326 RETVAL = overlay->w;
3331 OverlayH ( overlay, ... )
3332 SDL_Overlay *overlay
3335 overlay->h = SvIV(ST(1));
3336 RETVAL = overlay->h;
3341 OverlayPlanes ( overlay, ... )
3342 SDL_Overlay *overlay
3345 overlay->planes = SvIV(ST(1));
3346 RETVAL = overlay->planes;
3351 OverlayHW ( overlay )
3352 SDL_Overlay *overlay
3354 RETVAL = overlay->hw_overlay;
3359 OverlayPitches ( overlay )
3360 SDL_Overlay *overlay
3362 RETVAL = overlay->pitches;
3367 OverlayPixels ( overlay )
3368 SDL_Overlay *overlay
3370 RETVAL = overlay->pixels;
3375 WMToggleFullScreen ( surface )
3376 SDL_Surface *surface
3378 RETVAL = SDL_WM_ToggleFullScreen(surface);
3383 WMGrabInput ( mode )
3386 RETVAL = SDL_WM_GrabInput(mode);
3393 RETVAL = SDL_WM_IconifyWindow();
3401 RETVAL = e->resize.w;
3409 RETVAL = e->resize.h;
3417 RETVAL = SDL_AudioDriverName(name,32);
3425 if (k >= SDLK_LAST) Perl_croak (aTHX_ "Key out of range");
3426 RETVAL = SDL_GetKeyState(NULL)[k];
3435 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3440 FreeSMPEGInfo ( info )
3446 SMPEGInfoHasAudio ( info )
3449 RETVAL = info->has_audio;
3454 SMPEGInfoHasVideo ( info )
3457 RETVAL = info->has_video;
3462 SMPEGInfoWidth ( info )
3465 RETVAL = info->width;
3470 SMPEGInfoHeight ( info )
3473 RETVAL = info->height;
3478 SMPEGInfoCurrentFrame ( info )
3481 RETVAL = info->current_frame;
3486 SMPEGInfoCurrentFPS ( info )
3489 RETVAL = info->current_fps;
3494 SMPEGInfoCurrentAudioFrame ( info )
3497 RETVAL = info->audio_current_frame;
3502 SMPEGInfoCurrentOffset ( info )
3505 RETVAL = info->current_offset;
3510 SMPEGInfoTotalSize ( info )
3513 RETVAL = info->total_size;
3518 SMPEGInfoCurrentTime ( info )
3521 RETVAL = info->current_time;
3526 SMPEGInfoTotalTime ( info )
3529 RETVAL = info->total_time;
3537 RETVAL = SMPEG_error(mpeg);
3542 NewSMPEG ( filename, info, use_audio )
3547 #ifdef HAVE_SDL_MIXER
3548 RETVAL = SMPEG_new(filename,info,0);
3550 RETVAL = SMPEG_new(filename,info,use_audio);
3562 SMPEGEnableAudio ( mpeg , flag )
3566 SMPEG_enableaudio(mpeg,flag);
3567 #ifdef HAVE_SDL_MIXER
3568 sdl_perl_use_smpeg_audio = flag;
3572 SMPEGEnableVideo ( mpeg , flag )
3576 SMPEG_enablevideo(mpeg,flag);
3579 SMPEGSetVolume ( mpeg , volume )
3583 SMPEG_setvolume(mpeg,volume);
3586 SMPEGSetDisplay ( mpeg, dest, surfLock )
3591 SMPEG_setdisplay(mpeg,dest,surfLock,NULL);
3594 SMPEGScaleXY ( mpeg, w, h)
3599 SMPEG_scaleXY(mpeg,w,h);
3602 SMPEGScale ( mpeg, scale )
3606 SMPEG_scale(mpeg,scale);
3612 SDL_AudioSpec audiofmt;
3615 #ifdef HAVE_SDL_MIXER
3616 if (sdl_perl_use_smpeg_audio ) {
3617 SMPEG_enableaudio(mpeg, 0);
3618 Mix_QuerySpec(&freq, &format, &channels);
3619 audiofmt.format = format;
3620 audiofmt.freq = freq;
3621 audiofmt.channels = channels;
3622 SMPEG_actualSpec(mpeg, &audiofmt);
3623 Mix_HookMusic(SMPEG_playAudioSDL, mpeg);
3624 SMPEG_enableaudio(mpeg, 1);
3630 SMPEGStatus ( mpeg )
3633 RETVAL = SMPEG_status(mpeg);
3644 SMPEGLoop ( mpeg, repeat )
3648 SMPEG_loop(mpeg,repeat);
3655 #ifdef HAVE_SDL_MIXER
3656 Mix_HookMusic(NULL, NULL);
3660 SMPEGRewind ( mpeg )
3666 SMPEGSeek ( mpeg, bytes )
3670 SMPEG_seek(mpeg,bytes);
3673 SMPEGSkip ( mpeg, seconds )
3677 SMPEG_skip(mpeg,seconds);
3680 SMPEGSetDisplayRegion ( mpeg, rect )
3684 SMPEG_setdisplayregion(mpeg,rect->x,rect->y,rect->w,rect->h);
3687 SMPEGRenderFrame ( mpeg, frame )
3691 SMPEG_renderFrame(mpeg,frame);
3694 SMPEGGetInfo ( mpeg )
3697 RETVAL = (SMPEG_Info *) safemalloc (sizeof(SMPEG_Info));
3698 SMPEG_getinfo(mpeg,RETVAL);
3708 GFXRotoZoom ( src, angle, zoom, smooth)
3714 RETVAL = rotozoomSurface( src, angle, zoom, smooth);
3719 GFXZoom ( src, zoomx, zoomy, smooth)
3725 RETVAL = zoomSurface( src, zoomx, zoomy, smooth);
3730 GFXPixelColor ( dst, x, y, color )
3736 RETVAL = pixelColor( dst, x, y, color);
3741 GFXPixelRGBA ( dst, x, y, r, g, b, a )
3750 RETVAL = pixelRGBA( dst, x, y, r, g, b, a );
3755 GFXHlineColor ( dst, x1, x2, y, color )
3762 RETVAL = hlineColor( dst, x1, x2, y, color );
3767 GFXHlineRGBA ( dst, x1, x2, y, r, g, b, a )
3777 RETVAL = hlineRGBA( dst, x1, x2, y, r, g, b, a );
3782 GFXVlineColor ( dst, x, y1, y2, color )
3789 RETVAL = vlineColor( dst, x, y1, y2, color );
3794 GFXVlineRGBA ( dst, x, y1, y2, r, g, b, a )
3804 RETVAL = vlineRGBA( dst, x, y1, y2, r, g, b, a );
3809 GFXRectangleColor ( dst, x1, y1, x2, y2, color )
3817 RETVAL = rectangleColor( dst, x1, y1, x2, y2, color );
3822 GFXRectangleRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3833 RETVAL = rectangleRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3838 GFXBoxColor ( dst, x1, y1, x2, y2, color )
3846 RETVAL = boxColor( dst, x1, y1, x2, y2, color );
3851 GFXBoxRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3862 RETVAL = boxRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3867 GFXLineColor ( dst, x1, y1, x2, y2, color )
3875 RETVAL = lineColor( dst, x1, y1, x2, y2, color );
3880 GFXLineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3891 RETVAL = lineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3896 GFXAalineColor ( dst, x1, y1, x2, y2, color )
3904 RETVAL = aalineColor( dst, x1, y1, x2, y2, color );
3909 GFXAalineRGBA ( dst, x1, y1, x2, y2, r, g, b, a )
3920 RETVAL = aalineRGBA( dst, x1, y1, x2, y2, r, g, b, a );
3925 GFXCircleColor ( dst, x, y, r, color )
3932 RETVAL = circleColor( dst, x, y, r, color );
3937 GFXCircleRGBA ( dst, x, y, rad, r, g, b, a )
3947 RETVAL = circleRGBA( dst, x, y, rad, r, g, b, a );
3952 GFXAacircleColor ( dst, x, y, r, color )
3959 RETVAL = aacircleColor( dst, x, y, r, color );
3964 GFXAacircleRGBA ( dst, x, y, rad, r, g, b, a )
3974 RETVAL = aacircleRGBA( dst, x, y, rad, r, g, b, a );
3979 GFXFilledCircleColor ( dst, x, y, r, color )
3986 RETVAL = filledCircleColor( dst, x, y, r, color );
3991 GFXFilledCircleRGBA ( dst, x, y, rad, r, g, b, a )
4001 RETVAL = filledCircleRGBA( dst, x, y, rad, r, g, b, a );
4006 GFXEllipseColor ( dst, x, y, rx, ry, color )
4014 RETVAL = ellipseColor( dst, x, y, rx, ry, color );
4019 GFXEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
4030 RETVAL = ellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
4035 GFXAaellipseColor ( dst, xc, yc, rx, ry, color )
4043 RETVAL = aaellipseColor( dst, xc, yc, rx, ry, color );
4048 GFXAaellipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
4059 RETVAL = aaellipseRGBA( dst, x, y, rx, ry, r, g, b, a );
4064 GFXFilledEllipseColor ( dst, x, y, rx, ry, color )
4072 RETVAL = filledEllipseColor( dst, x, y, rx, ry, color );
4077 GFXFilledEllipseRGBA ( dst, x, y, rx, ry, r, g, b, a )
4088 RETVAL = filledEllipseRGBA( dst, x, y, rx, ry, r, g, b, a );
4093 GFXFilledPieColor ( dst, x, y, rad, start, end, color )
4102 RETVAL = filledPieColor( dst, x, y, rad, start, end, color );
4107 GFXFilledPieRGBA ( dst, x, y, rad, start, end, r, g, b, a )
4119 RETVAL = filledPieRGBA( dst, x, y, rad, start, end, r, g, b, a );
4124 GFXPolygonColor ( dst, vx, vy, n, color )
4131 RETVAL = polygonColor( dst, vx, vy, n, color );
4136 GFXPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4146 RETVAL = polygonRGBA( dst, vx, vy, n, r, g, b, a );
4151 GFXAapolygonColor ( dst, vx, vy, n, color )
4158 RETVAL = aapolygonColor( dst, vx, vy, n, color );
4163 GFXAapolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4173 RETVAL = aapolygonRGBA( dst, vx, vy, n, r, g, b, a );
4178 GFXFilledPolygonColor ( dst, vx, vy, n, color )
4185 RETVAL = filledPolygonColor( dst, vx, vy, n, color );
4190 GFXFilledPolygonRGBA ( dst, vx, vy, n, r, g, b, a )
4200 RETVAL = filledPolygonRGBA( dst, vx, vy, n, r, g, b, a );
4205 GFXCharacterColor ( dst, x, y, c, color )
4212 RETVAL = characterColor( dst, x, y, c, color );
4217 GFXCharacterRGBA ( dst, x, y, c, r, g, b, a )
4227 RETVAL = characterRGBA( dst, x, y, c, r, g, b, a );
4232 GFXStringColor ( dst, x, y, c, color )
4239 RETVAL = stringColor( dst, x, y, c, color );
4244 GFXStringRGBA ( dst, x, y, c, r, g, b, a )
4254 RETVAL = stringRGBA( dst, x, y, c, r, g, b, a );
4264 SVG_Load ( filename )
4267 RETVAL = SVG_Load(filename);
4272 SVG_LoadBuffer ( data, len )
4276 RETVAL = SVG_LoadBuffer(data,len);
4281 SVG_SetOffset ( source, xoff, yoff )
4282 SDL_svg_context* source
4286 RETVAL = SVG_SetOffset(source,xoff,yoff);
4291 SVG_SetScale ( source, xscale, yscale )
4292 SDL_svg_context* source
4296 RETVAL = SVG_SetScale(source,xscale,yscale);
4301 SVG_RenderToSurface ( source, x, y, dest )
4302 SDL_svg_context* source
4307 RETVAL = SVG_RenderToSurface(source,x,y,dest);
4313 SDL_svg_context* source
4318 SVG_Set_Flags ( source, flags )
4319 SDL_svg_context* source
4322 SVG_Set_Flags(source,flags);
4325 SVG_Width ( source )
4326 SDL_svg_context* source
4328 RETVAL = SVG_Width(source);
4333 SVG_HEIGHT ( source )
4334 SDL_svg_context* source
4336 RETVAL = SVG_Height(source);
4341 SVG_SetClipping ( source, minx, miny, maxx, maxy )
4342 SDL_svg_context* source
4348 SVG_SetClipping(source,minx,miny,maxx,maxy);
4353 RETVAL = SVG_Version();
4360 #ifdef HAVE_SDL_SOUND
4363 SoundAudioInfoFormat ( audioinfo )
4364 Sound_AudioInfo* audioinfo
4366 RETVAL = audioinfo->format;
4371 SoundAudioInfoChannels ( audioinfo )
4372 Sound_AudioInfo* audioinfo
4374 RETVAL = audioinfo->channels;
4379 SoundAudioInforate ( audioinfo )
4380 Sound_AudioInfo* audioinfo
4382 RETVAL = audioinfo->rate;
4387 SoundDecoderInfoExtensions ( decoderinfo )
4388 Sound_DecoderInfo* decoderinfo
4391 for ( ext = decoderinfo->extensions; *ext != NULL; ext++ ){
4392 av_push(RETVAL,newSVpv(*ext,0));
4398 SoundDecoderInfoDescription ( decoderinfo )
4399 Sound_DecoderInfo* decoderinfo
4401 RETVAL = decoderinfo->description;
4406 SoundDecoderInfoAuthor ( decoderinfo )
4407 Sound_DecoderInfo* decoderinfo
4409 RETVAL = decoderinfo->author;
4414 SoundDecoderInfoUrl ( decoderinfo )
4415 Sound_DecoderInfo* decoderinfo
4417 RETVAL = decoderinfo->url;
4421 const Sound_DecoderInfo*
4422 SoundSampleDecoder ( sample )
4423 Sound_Sample* sample
4425 RETVAL = sample->decoder;
4430 SoundSampleDesired ( sample )
4431 Sound_Sample* sample
4433 RETVAL = &sample->desired;
4438 SoundSampleAcutal ( sample )
4439 Sound_Sample* sample
4441 RETVAL = &sample->actual;
4446 SoundSampleBuffer ( sample )
4447 Sound_Sample* sample
4449 RETVAL = sample->buffer;
4454 SoundSampleBufferSize ( sample )
4455 Sound_Sample* sample
4457 RETVAL = sample->buffer_size;
4462 SoundSampleFlags ( sample )
4463 Sound_Sample* sample
4465 RETVAL = (Uint32)sample->flags;
4472 RETVAL = Sound_Init();
4479 RETVAL = Sound_Quit();
4484 Sound_AvailableDecoders ( )
4487 const Sound_DecoderInfo** sdi;
4488 sdi = Sound_AvailableDecoders();
4490 for (;*sdi != NULL; ++sdi) {
4491 av_push(RETVAL,sv_2mortal(newSViv(PTR2IV(*sdi))));
4500 RETVAL = Sound_GetError();
4505 Sound_ClearError ( )
4510 Sound_NewSample ( rw, ext, desired, buffsize )
4513 Sound_AudioInfo* desired
4516 RETVAL = Sound_NewSample(rw,ext,desired,buffsize);
4521 Sound_NewSampleFromMem ( data, size, ext, desired, buffsize )
4525 Sound_AudioInfo* desired
4528 RETVAL = Sound_NewSampleFromMem(data,size,ext,desired,buffsize);
4533 Sound_NewSampleFromFile ( fname, desired, buffsize )
4535 Sound_AudioInfo* desired
4538 RETVAL = Sound_NewSampleFromFile(fname,desired,buffsize);
4543 Sound_FreeSample ( sample )
4544 Sound_Sample* sample
4546 Sound_FreeSample(sample);
4549 Sound_GetDuration ( sample )
4550 Sound_Sample* sample
4552 RETVAL = Sound_GetDuration(sample);
4557 Sound_SetBufferSize ( sample, size )
4558 Sound_Sample* sample
4561 RETVAL = Sound_SetBufferSize(sample,size);
4566 Sound_Decode ( sample )
4567 Sound_Sample* sample
4569 RETVAL = Sound_Decode(sample);
4574 Sound_DecodeAll ( sample )
4575 Sound_Sample* sample
4577 RETVAL = Sound_DecodeAll(sample);
4582 Sound_Rewind ( sample )
4583 Sound_Sample* sample
4585 RETVAL = Sound_Rewind(sample);
4590 Sound_Seek ( sample, ms )
4591 Sound_Sample* sample
4594 RETVAL = Sound_Seek(sample,ms);
4600 MODULE = SDL PACKAGE = SDL
4601 PROTOTYPES : DISABLE