X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fintergation1.t;h=eb9cd9875e77db8ca9893453cf81350806ac4c4d;hb=350e894348b0c3a73f203014ba6d92cdb4f7f4ee;hp=e027e861780d8f1df9e42b4b4fd679c1d3abf6bd;hpb=4447e1165b80878ce86f62c3e0023ab4098a639b;p=sdlgit%2FSDL_perl.git diff --git a/t/intergation1.t b/t/intergation1.t index e027e86..eb9cd98 100644 --- a/t/intergation1.t +++ b/t/intergation1.t @@ -60,37 +60,27 @@ can_ok ('SDL::App', qw/ sync attribute /); -my $app = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init => SDL_INIT_VIDEO); + my $app = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init => SDL_INIT_VIDEO); - my $rect = SDL::Rect->new( 0,0, 10, 20); + my $rect = SDL::Rect->new( 0,0, $app->w, $app->h); - my $blue = SDL::Color->new( - -r => 0x00, - -g => 0x00, - -b => 0xff, - ); + 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 $col = SDL::Color->new( - -r => 0xf0, - -g => 0x00, - -b => 0xff, - ); - - - my $grect = SDL::Game::Rect->new(10, 10, 30, 5); - foreach(0..20) + my $grect = SDL::Game::Rect->new(10, 10, 30, 35); + foreach(0..80) { - print $_; - $rect->x($_); - $grect->x($_); - $app->fill($rect, $blue); - $app->fill($grect, $col); + $grect->x($_ ); + $grect->centery($_ * 3); + $grect->size( ($_ / 40) * $_, ($_/38) * $_ ); + SDL::FillRect( $app, $rect, $blue_pixel ); + SDL::FillRect( $app, $grect, $col_pixel ); - $app->update($rect); - $app->update($grect); - $app->sync; + SDL::UpdateRect($app, 0, 0, 640, 480); + SDL::Delay(10); } - sleep(1); + SDL::Delay(100);