use strict;
use SDL;
use SDL::Config;
-use SDL::Rect;
+#use SDL::Rect;
+use SDL::Game::Rect;
use SDL::Color;
use Test::More;
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::Game::Rect->new( 0,0, 10, 20);
my $blue = SDL::Color->new(
-r => 0x00,
-g => 0x00,
-b => 0xff,
);
+
+ my $col = SDL::Color->new(
+ -r => 0xf0,
+ -g => 0x00,
+ -b => 0xff,
+ );
+
+
+ my $grect = SDL::Game::Rect->new(10, 10, 30, 5);
$app->fill($rect, $blue);
+ $app->fill($grect, $col);
$app->update($rect);
-
+ $app->update($grect);
$app->sync;
sleep(1);
use Test::More tests => 87;
use strict;
use SDL;
-use SDL::App;
-use SDL::Color;
use_ok( 'SDL::Game::Rect' );
my $app = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init => SDL_INIT_VIDEO);
-my $rect = SDL::Game::Rect->new();
-
-
- my $blue = SDL::Color->new(
- -r => 0x00,
- -g => 0x00,
- -b => 0xff,
- );
- $app->fill($rect,$blue);
- $app->update($rect);
- $app->sync;
- sleep(1);
+my $rect = SDL::Game::Rect->new( 0, 10, 0, 0);
+
isa_ok ($rect, 'SDL::Game::Rect','new went ok');
foreach my $attr (qw(x y top left width height
is ($rect->y(123), 123, 'y is now 123');
is ($rect->top, 123, 'top is an alias to y');
- $app->fill($rect,$blue);
- $app->update($rect);
- $app->sync;
- sleep(1);
is ($rect->w(54), 54, 'w is now 54');
is ($rect->width(45), 45, 'w is now 45');
is ($rect->w, 45, 'w is an alias to width');
+
is ($rect->h(76), 76, 'h is now 76');
is ($rect->height, 76, 'h and height point to the same place');
is ($rect->height(67), 67, 'h is now 67');