X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2FCore%2FVideo.xs;h=836fff11bbf15aca21a1f19d5af0322b7b48722e;hb=69341787b9240e7450bc15ed0466218d37d8de20;hp=a7a6b34d4d11a8467873463b7528c8069f464559;hpb=eaf32d63cd5d036a165cbbcb1200bca441d2aa84;p=sdlgit%2FSDL_perl.git diff --git a/src/Core/Video.xs b/src/Core/Video.xs index a7a6b34..836fff1 100644 --- a/src/Core/Video.xs +++ b/src/Core/Video.xs @@ -87,6 +87,21 @@ video_video_mode_ok ( width, height, bpp, flags ) OUTPUT: RETVAL + +SDL_Surface * +video_set_video_mode ( width, height, bpp, flags ) + int width + int height + int bpp + Uint32 flags + PREINIT: + char* CLASS = "SDL::Surface"; + CODE: + RETVAL = SDL_SetVideoMode(width,height,bpp,flags); + OUTPUT: + RETVAL + + void video_update_rect ( surface, x, y, w ,h ) SDL_Surface *surface @@ -113,3 +128,64 @@ video_update_rects ( surface, ... ) safefree(rects); +int +video_flip ( surface ) + SDL_Surface *surface + CODE: + RETVAL = SDL_Flip(surface); + OUTPUT: + RETVAL + +int +video_set_colors ( surface, start, ... ) + SDL_Surface *surface + int start + CODE: + SDL_Color *colors,*temp; + int i, length; + if ( items < 3 ) { RETVAL = 0;} + else + { + length = items - 2; + colors = (SDL_Color *)safemalloc(sizeof(SDL_Color)*(length+1)); + for ( i = 0; i < length ; i++ ) { + temp = (SDL_Color *)SvIV(ST(i+2)); + colors[i].r = temp->r; + colors[i].g = temp->g; + colors[i].b = temp->b; + } + RETVAL = SDL_SetColors(surface, colors, start, length ); + safefree(colors); + } + + OUTPUT: + RETVAL + +int +video_set_palette ( surface, flags, start, ... ) + SDL_Surface *surface + int flags + int start + + CODE: + SDL_Color *colors,*temp; + int i, length; + if ( items < 4 ) { + RETVAL = 0; + } + else + { + length = items - 3; + colors = (SDL_Color *)safemalloc(sizeof(SDL_Color)*(length+1)); + for ( i = 0; i < length ; i++ ){ + temp = (SDL_Color *)SvIV(ST(i+3)); + colors[i].r = temp->r; + colors[i].g = temp->g; + colors[i].b = temp->b; + } + RETVAL = SDL_SetPalette(surface, flags, colors, start, length ); + safefree(colors); + } + OUTPUT: + RETVAL +