X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2FSDL.xs;h=7994608e5b490104fd1a0305b37a2cd2c7f8dc1c;hb=f7ce55ec6ad0a21bb1fa18aec222fa0274764557;hp=09c2dbdc1c12440f15a8d98ba9477710ca870dd9;hpb=e4ab5b2e8635df41fd14c9e92e2c3ec7277bda0a;p=sdlgit%2FSDL_perl.git diff --git a/src/SDL.xs b/src/SDL.xs index 09c2dbd..7994608 100644 --- a/src/SDL.xs +++ b/src/SDL.xs @@ -858,22 +858,22 @@ GetKeyName ( sym ) OUTPUT: RETVAL +#ifdef HAVE_SDL_IMAGE + SDL_Surface * -CreateRGBSurface (flags, width, height, depth, Rmask, Gmask, Bmask, Amask ) - Uint32 flags - int width - int height - int depth - Uint32 Rmask - Uint32 Gmask - Uint32 Bmask - Uint32 Amask +IMG_Load ( filename ) + char *filename CODE: - RETVAL = SDL_CreateRGBSurface ( flags, width, height, - depth, Rmask, Gmask, Bmask, Amask ); - OUTPUT: + char* CLASS = "SDL::Surface"; + RETVAL = IMG_Load(filename); + OUTPUT: RETVAL +#endif + +=for comment + +Comment out for now as it does not compile SDL_Surface * CreateRGBSurfaceFrom (pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, Amask ) @@ -896,18 +896,6 @@ CreateRGBSurfaceFrom (pixels, width, height, depth, pitch, Rmask, Gmask, Bmask, OUTPUT: RETVAL -#ifdef HAVE_SDL_IMAGE - -SDL_Surface * -IMGLoad ( fname ) - char *fname - CODE: - RETVAL = IMG_Load(fname); - OUTPUT: - RETVAL - -#endif - SDL_Surface* SurfaceCopy ( surface ) SDL_Surface *surface @@ -1079,6 +1067,12 @@ SurfacePixels ( surface ) OUTPUT: RETVAL +=cut + +=for comment + +Comment out for now as it does not compile + SDL_Color* SurfacePixel ( surface, x, y, ... ) SDL_Surface *surface @@ -1172,6 +1166,7 @@ GetVideoSurface () OUTPUT: RETVAL +=cut HV * VideoInfo () @@ -1225,88 +1220,102 @@ ListModes ( format, flags ) OUTPUT: RETVAL - -SDL_Color * -NewColor ( r, g, b ) - Uint8 r - Uint8 g - Uint8 b +SDL_Palette * +NewPalette ( number ) + int number CODE: - RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color)); - RETVAL->r = r; - RETVAL->g = g; - RETVAL->b = b; + RETVAL = (SDL_Palette *)safemalloc(sizeof(SDL_Palette)); + RETVAL->colors = (SDL_Color *)safemalloc(number * + sizeof(SDL_Color)); + RETVAL->ncolors = number; OUTPUT: RETVAL -Uint8 -ColorR ( color, ... ) - SDL_Color *color +int +PaletteNColors ( palette, ... ) + SDL_Palette *palette CODE: - if (items > 1 ) color->r = SvIV(ST(1)); - RETVAL = color->r; + if ( items > 1 ) palette->ncolors = SvIV(ST(1)); + RETVAL = palette->ncolors; OUTPUT: RETVAL -Uint8 -ColorG ( color, ... ) - SDL_Color *color +SDL_Surface * +SetVideoMode ( width, height, bpp, flags ) + + int width + int height + int bpp + Uint32 flags + CODE: - if (items > 1 ) color->g = SvIV(ST(1)); - RETVAL = color->g; + char *CLASS = "SDL::Surface"; + RETVAL = SDL_SetVideoMode(width,height,bpp,flags); OUTPUT: RETVAL -Uint8 -ColorB ( color, ... ) - SDL_Color *color +int +Flip ( surface ) + SDL_Surface *surface CODE: - if (items > 1 ) color->b = SvIV(ST(1)); - RETVAL = color->b; + RETVAL = SDL_Flip(surface); OUTPUT: RETVAL +int +BlitSurface ( src, src_rect, dest, dest_rect ) + SDL_Surface *src + SDL_Surface *dest + SDL_Rect *src_rect + SDL_Rect *dest_rect + CODE: + RETVAL = SDL_BlitSurface(src,src_rect,dest,dest_rect); + OUTPUT: + RETVAL -void -ColorRGB ( color, ... ) - SDL_Color *color - PPCODE: - if (items > 1 ) { - color->r = SvIV(ST(1)); - color->g = SvIV(ST(2)); - color->b = SvIV(ST(3)); - } - mXPUSHi( color->r ); - mXPUSHi( color->g ); - mXPUSHi( color->b ); - XSRETURN(3); +Uint32 +MapRGB ( pixel_format, r, g, b ) + SDL_PixelFormat *pixel_format + Uint8 r + Uint8 g + Uint8 b + CODE: + RETVAL = SDL_MapRGB(pixel_format,r,g,b); + OUTPUT: + RETVAL void -FreeColor ( color ) - SDL_Color *color +UpdateRect ( surface, x, y, w ,h ) + SDL_Surface *surface + int x + int y + int w + int h CODE: - return; safefree(color); + SDL_UpdateRect(surface,x,y,w,h); -SDL_Palette * -NewPalette ( number ) - int number +SDL_Surface * +DisplayFormat ( surface ) + SDL_Surface *surface CODE: - RETVAL = (SDL_Palette *)safemalloc(sizeof(SDL_Palette)); - RETVAL->colors = (SDL_Color *)safemalloc(number * - sizeof(SDL_Color)); - RETVAL->ncolors = number; + char* CLASS = "SDL::Surface"; + RETVAL = SDL_DisplayFormat(surface); OUTPUT: RETVAL -int -PaletteNColors ( palette, ... ) - SDL_Palette *palette +SDL_Surface * +DisplayFormatAlpha ( surface ) + SDL_Surface *surface CODE: - if ( items > 1 ) palette->ncolors = SvIV(ST(1)); - RETVAL = palette->ncolors; + char* CLASS = "SDL::Surface"; + RETVAL = SDL_DisplayFormatAlpha(surface); OUTPUT: RETVAL +=for comment + +Comment out for now as it does not compile + SDL_Color * PaletteColors ( palette, index, ... ) SDL_Palette *palette @@ -1321,6 +1330,8 @@ PaletteColors ( palette, index, ... ) OUTPUT: RETVAL + + int VideoModeOK ( width, height, bpp, flags ) int width @@ -1344,24 +1355,14 @@ SetVideoMode ( width, height, bpp, flags ) RETVAL void -UpdateRect ( surface, x, y, w ,h ) - SDL_Surface *surface - int x - int y - int w - int h - CODE: - SDL_UpdateRect(surface,x,y,w,h); - -void UpdateRects ( surface, ... ) SDL_Surface *surface CODE: - SDL_Rect *rects, *oldrects, *temp; + SDL_Rect *rects, *temp; int num_rects,i; if ( items < 2 ) return; num_rects = items - 1; - oldrects = rects; + SDL_UpdateRects(surface,num_rects,rects); rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items); for(i=0;iformat,r,g,b); - OUTPUT: - RETVAL - -Uint32 MapRGBA ( surface, r, g, b, a ) SDL_Surface *surface Uint8 r @@ -1486,22 +1475,6 @@ SetAlpha ( surface, flag, alpha ) OUTPUT: RETVAL -SDL_Surface * -DisplayFormat ( surface ) - SDL_Surface *surface - CODE: - RETVAL = SDL_DisplayFormat(surface); - OUTPUT: - RETVAL - -SDL_Surface* -DisplayFormatAlpha ( surface ) - SDL_Surface *surface - CODE: - RETVAL = SDL_DisplayFormatAlpha(surface); - OUTPUT: - RETVAL - SDL_Surface* ConvertRGB ( surface ) SDL_Surface * surface @@ -1554,24 +1527,14 @@ ConvertRGBA ( surface ) OUTPUT: RETVAL -int -BlitSurface ( src, src_rect, dest, dest_rect ) - SDL_Surface *src - SDL_Rect *src_rect - SDL_Surface *dest - SDL_Rect *dest_rect - CODE: - RETVAL = SDL_BlitSurface(src,src_rect,dest,dest_rect); - OUTPUT: - RETVAL +=cut int -FillRect ( dest, dest_rect, color ) +FillRect ( dest, dest_rect, pixel ) SDL_Surface *dest SDL_Rect *dest_rect - SDL_Color *color + Uint32 pixel CODE: - Uint32 pixel = SDL_MapRGB(dest->format,color->r,color->g,color->b); RETVAL = SDL_FillRect(dest,dest_rect,pixel); OUTPUT: RETVAL @@ -2195,6 +2158,15 @@ MixPlayingMusic() OUTPUT: RETVAL +int +MixSetPanning ( channel, left, right ) + int channel + int left + int right + CODE: + RETVAL = Mix_SetPanning(channel, left, right); + OUTPUT: + RETVAL void MixCloseAudio () @@ -2924,15 +2896,14 @@ TTFSizeText ( font, text ) RETVAL = newAV(); if(TTF_SizeText(font,text,&w,&h)) { - av_push(RETVAL,newSViv(w)); - av_push(RETVAL,newSViv(h)); - sv_2mortal((SV*)RETVAL); + printf("TTF error at TTFSizeText: %s \n", TTF_GetError()); + Perl_croak (aTHX_ "TTF error \n"); } else { - printf("TTF error at TTFSizeText: %s \n", TTF_GetError()); - Perl_croak (aTHX_ "TTF error \n"); - + av_push(RETVAL,newSViv(w)); + av_push(RETVAL,newSViv(h)); + sv_2mortal((SV*)RETVAL); } @@ -2985,6 +2956,8 @@ TTFSizeUNICODE ( font, text ) OUTPUT: RETVAL +=for comment + SDL_Surface* TTFRenderTextSolid ( font, text, fg ) TTF_Font *font @@ -3208,6 +3181,8 @@ TTFPutString ( font, mode, surface, x, y, fg, bg, text ) OUTPUT: RETVAL +=cut + #endif SDL_Overlay* @@ -3647,6 +3622,8 @@ SMPEGGetInfo ( mpeg ) #ifdef HAVE_SDL_GFX +=cut + SDL_Surface * GFXRotoZoom ( src, angle, zoom, smooth) SDL_Surface * src @@ -3669,6 +3646,8 @@ GFXZoom ( src, zoomx, zoomy, smooth) OUTPUT: RETVAL +=cut + int GFXPixelColor ( dst, x, y, color ) SDL_Surface* dst