Merged garu's changes: new Game::Rect, TTFont docs, and tests for
[sdlgit/SDL_perl.git] / lib / SDL / Color.pm
index 287a3ca..2c426e4 100644 (file)
@@ -38,8 +38,10 @@ use SDL;
 sub new {
        my $proto = shift;
        my $class = ref($proto) || $proto;
-       my $self;
+       return bless \SDL::NewColor(@_), $class if (@_ == 3);
 
+       my $self;
+       
        my (%options) = @_;
 
        verify (%options, qw/ -color -surface -pixel -r -g -b /) if $SDL::DEBUG;
@@ -82,6 +84,11 @@ sub b {
        SDL::ColorB($$self,@_);
 }
 
+sub rgb {
+ my $self = shift;
+ SDL::ColorRGB($$self,@_);
+}
+
 sub pixel {
        croak "SDL::Color::pixel requires an SDL::Surface"
                unless !$SDL::DEBUG || $_[1]->isa("SDL::Surface");