From: Kartik Thakore Date: Thu, 8 Oct 2009 01:48:26 +0000 (-0400) Subject: need to return values of Rect* and so on X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4447e1165b80878ce86f62c3e0023ab4098a639b;p=sdlgit%2FSDL_perl.git need to return values of Rect* and so on --- diff --git a/lib/SDL/Rect.pm b/lib/SDL/Rect.pm index 6c91762..ea1c144 100644 --- a/lib/SDL/Rect.pm +++ b/lib/SDL/Rect.pm @@ -22,45 +22,45 @@ bootstrap SDL::Rect; # would be another call and rects are a time-critical object. sub left { my $self = shift; - RectX($self,@_); + return RectX($self,@_); } sub x { my $self = shift; - RectX($self,@_); + return RectX($self,@_); } ### TODO: see 'left' above (this is an 'alias' to sub y) sub top { my $self = shift; - RectY($self,@_); + return RectY($self,@_); } sub y { my $self = shift; - RectY($self,@_); + return RectY($self,@_); } ### TODO: see 'left' above (this is an 'alias' to sub width) sub w { my $self = shift; - RectW($self,@_); + return RectW($self,@_); } sub width { my $self = shift; - RectW($self,@_); + return RectW($self,@_); } ### TODO: see 'left' above (this is an 'alias' to sub height) sub h { my $self = shift; - RectH($self,@_); + return RectH($self,@_); } sub height { my $self = shift; - RectH($self,@_); + return RectH($self,@_); } diff --git a/t/intergation1.t b/t/intergation1.t index e0d2426..e027e86 100644 --- a/t/intergation1.t +++ b/t/intergation1.t @@ -36,7 +36,7 @@ BEGIN { use strict; use SDL; use SDL::Config; -#use SDL::Rect; +use SDL::Rect; use SDL::Game::Rect; use SDL::Color; use Test::More; @@ -62,7 +62,7 @@ can_ok ('SDL::App', qw/ my $app = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init => SDL_INIT_VIDEO); - my $rect = SDL::Game::Rect->new( 0,0, 10, 20); + my $rect = SDL::Rect->new( 0,0, 10, 20); my $blue = SDL::Color->new( -r => 0x00, @@ -78,11 +78,19 @@ my $app = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init my $grect = SDL::Game::Rect->new(10, 10, 30, 5); + foreach(0..20) + { + print $_; + $rect->x($_); + $grect->x($_); $app->fill($rect, $blue); $app->fill($grect, $col); + + $app->update($rect); $app->update($grect); + $app->sync; + } - $app->sync; sleep(1);