implemented normalize
Breno G. de Oliveira [Sun, 4 Oct 2009 07:11:41 +0000 (04:11 -0300)]
lib/SDL/Game/Rect.pm

index 18f4067..01368f0 100644 (file)
@@ -557,6 +557,21 @@ sub fit_ip {
     return;
 }
 
+sub normalize {
+    my $self = shift;
+    
+    if ($self->w < 0) {
+        $self->x($self->x + $self->w);
+        $self->w(-$self->w);
+    }
+    
+    if ($self->h < 0) {
+        $self->y( $self->y + $self->h);
+        $self->h(-$self->h);
+    }
+    return;
+}
+
 
 42;
 __END__