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;
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");