OUTPUT:
RETVAL
-int
-SurfaceLock ( surface )
- SDL_Surface *surface
- CODE:
- RETVAL = SDL_LockSurface(surface);
- OUTPUT:
- RETVAL
-
-void
-SurfaceUnlock ( surface )
- SDL_Surface *surface
- CODE:
- SDL_UnlockSurface(surface);
-
-SDL_Surface *
-GetVideoSurface ()
- CODE:
- RETVAL = SDL_GetVideoSurface();
- OUTPUT:
- RETVAL
-
=cut
-HV *
-VideoInfo ()
- CODE:
- HV *hv;
- SDL_VideoInfo *info;
- info = (SDL_VideoInfo *) safemalloc ( sizeof(SDL_VideoInfo));
- memcpy(info,SDL_GetVideoInfo(),sizeof(SDL_VideoInfo));
- hv = newHV();
- hv_store(hv,"hw_available",strlen("hw_available"),
- newSViv(info->hw_available),0);
- hv_store(hv,"wm_available",strlen("wm_available"),
- newSViv(info->wm_available),0);
- hv_store(hv,"blit_hw",strlen("blit_hw"),
- newSViv(info->blit_hw),0);
- hv_store(hv,"blit_hw_CC",strlen("blit_hw_CC"),
- newSViv(info->blit_hw_CC),0);
- hv_store(hv,"blit_hw_A",strlen("blit_hw_A"),
- newSViv(info->blit_hw_A),0);
- hv_store(hv,"blit_sw",strlen("blit_sw"),
- newSViv(info->blit_sw),0);
- hv_store(hv,"blit_sw_CC",strlen("blit_sw_CC"),
- newSViv(info->blit_sw_CC),0);
- hv_store(hv,"blit_sw_A",strlen("blit_sw_A"),
- newSViv(info->blit_sw_A),0);
- hv_store(hv,"blit_fill",strlen("blit_fill"),
- newSViv(info->blit_fill),0);
- hv_store(hv,"video_mem",strlen("video_mem"),
- newSViv(info->video_mem),0);
- RETVAL = hv;
- OUTPUT:
- RETVAL
-
-AV*
-ListModes ( format, flags )
- Uint32 flags
- SDL_PixelFormat *format
- CODE:
- SDL_Rect **mode;
- RETVAL = newAV();
- mode = SDL_ListModes(format,flags);
- if (mode == (SDL_Rect**)-1 ) {
- av_push(RETVAL,newSVpv("all",0));
- } else if (! mode ) {
- av_push(RETVAL,newSVpv("none",0));
- } else {
- for (;*mode;mode++) {
- av_push(RETVAL,newSViv(PTR2IV(*mode)));
- }
- }
- OUTPUT:
- RETVAL
=skip
SDL_Palette *
OUTPUT:
RETVAL
-SDL_Surface *
-SetVideoMode ( width, height, bpp, flags )
-
- int width
- int height
- int bpp
- Uint32 flags
-
- CODE:
- char *CLASS = "SDL::Surface";
- RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
- OUTPUT:
- RETVAL
-
-int
-Flip ( surface )
- SDL_Surface *surface
- CODE:
- RETVAL = SDL_Flip(surface);
- OUTPUT:
- RETVAL
-
int
BlitSurface ( src, src_rect, dest, dest_rect )
SDL_Surface *src
OUTPUT:
RETVAL
-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
-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);
-
-SDL_Surface *
-DisplayFormat ( surface )
- SDL_Surface *surface
- CODE:
- char* CLASS = "SDL::Surface";
- RETVAL = SDL_DisplayFormat(surface);
- OUTPUT:
- RETVAL
-
-SDL_Surface *
-DisplayFormatAlpha ( surface )
- SDL_Surface *surface
- CODE:
- char* CLASS = "SDL::Surface";
- RETVAL = SDL_DisplayFormatAlpha(surface);
- OUTPUT:
- RETVAL
-
-void
-UpdateRects ( surface, ... )
- SDL_Surface *surface
- CODE:
- SDL_Rect *rects;
- int num_rects,i;
- if ( items < 2 ) return;
- num_rects = items - 1;
- rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
- for(i=0;i<num_rects;i++) {
- rects[i] = *(SDL_Rect *)SvIV((SV*)SvRV( ST(i + 1) ));
- }
- SDL_UpdateRects(surface,num_rects,rects);
- safefree(rects);
-
=for comment
Comment out for now as it does not compile
-int
-VideoModeOK ( width, height, bpp, flags )
- int width
- int height
- int bpp
- Uint32 flags
- CODE:
- RETVAL = SDL_VideoModeOK(width,height,bpp,flags);
- OUTPUT:
- RETVAL
-
-SDL_Surface *
-SetVideoMode ( width, height, bpp, flags )
- int width
- int height
- int bpp
- Uint32 flags
- CODE:
- RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
- OUTPUT:
- RETVAL
-
-int
-Flip ( surface )
- SDL_Surface *surface
- CODE:
- RETVAL = SDL_Flip(surface);
- OUTPUT:
- RETVAL
-
-int
-SetColors ( surface, start, ... )
- SDL_Surface *surface
- int start
- CODE:
- SDL_Color *colors,*temp;
- int i, length;
- if ( items < 3 ) { RETVAL = 0; goto all_done; }
- 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);
-all_done:
- OUTPUT:
- RETVAL
-
-Uint32
-MapRGBA ( surface, r, g, b, a )
- SDL_Surface *surface
- Uint8 r
- Uint8 g
- Uint8 b
- Uint8 a
- CODE:
- RETVAL = SDL_MapRGBA(surface->format,r,g,b,a);
- OUTPUT:
- RETVAL
-
AV *
GetRGB ( surface, pixel )
SDL_Surface *surface
OUTPUT:
RETVAL
-int
-SetColorKey ( surface, flag, key )
- SDL_Surface *surface
- Uint32 flag
- SDL_Color *key
- CODE:
- Uint32 pixel = SDL_MapRGB(surface->format,key->r,key->g,key->b);
- RETVAL = SDL_SetColorKey(surface,flag,pixel);
- OUTPUT:
- RETVAL
-
-int
-SetAlpha ( surface, flag, alpha )
- SDL_Surface *surface
- Uint32 flag
- Uint8 alpha
- CODE:
- RETVAL = SDL_SetAlpha(surface,flag,alpha);
- OUTPUT:
- RETVAL
-
SDL_Surface*
ConvertRGB ( surface )
SDL_Surface * surface
is( $pixel_format->colorkey, 0, '0 colorkey' );
is( $pixel_format->alpha, 255, '255 alpha' );
-my $pixel = SDL::MapRGB( $pixel_format, 255, 127, 0 );
+my $pixel = SDL::Video::map_RGB( $pixel_format, 255, 127, 0 );
is( $pixel, 32767, '32767 pixel' );
SDL::FillRect( $surface, SDL::Rect->new( 0, 0, 32, 32 ), $pixel );
ok( 1, 'Managed to fill_rect' );
pass 'did this pass';
-my $image_format = SDL::DisplayFormat($image);
+my $image_format = SDL::Video::display_format($image);
isa_ok( $image_format, 'SDL::Surface' );
-my $image_format_alpha = SDL::DisplayFormatAlpha($image);
+my $image_format_alpha = SDL::Video::display_format_alpha($image);
isa_ok( $image_format_alpha, 'SDL::Surface' );
my $app_pixel_format = $app->format;
my $rect = SDL::Rect->new( 0, 0, $app->w, $app->h );
-my $blue_pixel = SDL::MapRGB( $app_pixel_format, 0x00, 0x00, 0xff );
+my $blue_pixel = SDL::Video::map_RGB( $app_pixel_format, 0x00, 0x00, 0xff );
SDL::FillRect( $app, $rect, $blue_pixel );
SDL::Video::update_rect( $app, 0, 0, 0, 0 );
SDL::Video::update_rects( $app, $small_rect );
use SDL::Rect;
use SDL::Game::Rect;
use SDL::Color;
+use SDL::Video;
use Test::More;
plan ( tests => 2 );
my $rect = SDL::Rect->new( 0,0, $app->w, $app->h);
my $pixel_format = $app->format;
- my $blue_pixel = SDL::MapRGB( $pixel_format, 0x00, 0x00, 0xff );
- my $col_pixel = SDL::MapRGB( $pixel_format, 0xf0, 0x00, 0x33 );
+ my $blue_pixel = SDL::Video::map_RGB( $pixel_format, 0x00, 0x00, 0xff );
+ my $col_pixel = SDL::Video::map_RGB( $pixel_format, 0xf0, 0x00, 0x33 );
my $grect = SDL::Game::Rect->new(10, 10, 30, 35);
foreach(0..80)
SDL::FillRect( $app, $rect, $blue_pixel );
SDL::FillRect( $app, $grect, $col_pixel );
- SDL::UpdateRect($app, 0, 0, 640, 480);
+ SDL::Video::update_rect($app, 0, 0, 640, 480);
SDL::delay(10);
}