From: Leon Brocard Date: Mon, 2 Nov 2009 15:54:15 +0000 (+0000) Subject: Remove methods in SDL.xs that have been implemented in Video.xs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0bc4b7124412deb1a7bb86f6669ceea3152e428d;p=sdlgit%2FSDL_perl.git Remove methods in SDL.xs that have been implemented in Video.xs --- diff --git a/lib/SDL/App.pm b/lib/SDL/App.pm index fbc3084..137374e 100644 --- a/lib/SDL/App.pm +++ b/lib/SDL/App.pm @@ -37,6 +37,7 @@ use SDL; use SDL::Event; use SDL::Surface; use SDL::Rect; +use SDL::Video; our @ISA = qw(SDL::Surface); sub DESTROY { @@ -112,7 +113,7 @@ sub new { $SDL::App::USING_OPENGL = 0; } - my $self = SDL::SetVideoMode($w,$h,$d,$f) + my $self = SDL::Video::set_video_mode($w,$h,$d,$f) or croak SDL::get_error(); if ($ic and -e $ic) { @@ -195,7 +196,7 @@ sub sync ($) { if ($SDL::App::USING_OPENGL) { SDL::GLSwapBuffers() } else { - SDL::Flip($self); + SDL::Video::flip($self); } } diff --git a/src/SDL.xs b/src/SDL.xs index defa68c..d0260a6 100644 --- a/src/SDL.xs +++ b/src/SDL.xs @@ -1153,80 +1153,8 @@ MUSTLOCK ( surface ) 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 * @@ -1250,28 +1178,6 @@ PaletteNColors ( 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 @@ -1283,128 +1189,10 @@ BlitSurface ( src, src_rect, dest, dest_rect ) 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;ir; - 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 @@ -1443,27 +1231,6 @@ SaveBMP ( surface, filename ) 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 diff --git a/t/core_overlay.t b/t/core_overlay.t index f385ad2..0892c0c 100644 --- a/t/core_overlay.t +++ b/t/core_overlay.t @@ -3,12 +3,13 @@ use strict; use warnings; use Test::More tests => 2; use SDL; +use SDL::Video; use_ok('SDL::Overlay'); SDL::init(SDL_INIT_VIDEO); -my $display = SDL::SetVideoMode(640,480,32, SDL_SWSURFACE ); +my $display = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE ); my $overlay = SDL::Overlay->new( 100, 100, SDL_YV12_OVERLAY, $display); diff --git a/t/core_palette.t b/t/core_palette.t index a792614..3cbba7d 100644 --- a/t/core_palette.t +++ b/t/core_palette.t @@ -9,16 +9,17 @@ can_ok('SDL::Palette', qw/ ncolors colors color_index /); use SDL; use SDL::Surface; use SDL::PixelFormat; +use SDL::Video; SDL::init(SDL_INIT_VIDEO); -my $display = SDL::SetVideoMode(640,480,32, SDL_SWSURFACE ); +my $display = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE ); isa_ok($display->format, 'SDL::PixelFormat', 'Are we a SDL::PixelFormat?'); is( !defined $display->format->palette , 1, 'Palette is not defined as BitPerPixels is greater then 8'); -$display = SDL::SetVideoMode(640,480,8, SDL_SWSURFACE ); +$display = SDL::Video::set_video_mode(640,480,8, SDL_SWSURFACE ); isa_ok($display->format, 'SDL::PixelFormat', 'Are we a SDL::PixelFormat?'); isa_ok( $display->format->palette , 'SDL::Palette', 'Palette is SDL::Palette when BitPerPixels is 8 '); diff --git a/t/core_surface.t b/t/core_surface.t index e006f60..7cad96f 100644 --- a/t/core_surface.t +++ b/t/core_surface.t @@ -57,7 +57,7 @@ is( $pixel_format->Amask, 0, '0 Amask' ); 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' ); @@ -81,17 +81,17 @@ my $app = SDL::App->new( 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 ); diff --git a/t/intergation1.t b/t/intergation1.t index aefc51a..19cf0b1 100644 --- a/t/intergation1.t +++ b/t/intergation1.t @@ -39,6 +39,7 @@ use SDL::Config; use SDL::Rect; use SDL::Game::Rect; use SDL::Color; +use SDL::Video; use Test::More; plan ( tests => 2 ); @@ -65,8 +66,8 @@ can_ok ('SDL::App', qw/ 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) @@ -78,7 +79,7 @@ can_ok ('SDL::App', qw/ 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); }