Add FlipSurface function
This commit is contained in:
@@ -268,4 +268,18 @@ sub LoadVirtualSprite {
|
|||||||
return $anim;
|
return $anim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Flip surface left to right -- Returns new surface
|
||||||
|
sub FlipSurface {
|
||||||
|
my($surface) = @_;
|
||||||
|
my $new = SDLx::Surface->new( width => $surface->width(),
|
||||||
|
height => $surface->height(),
|
||||||
|
);
|
||||||
|
|
||||||
|
for(my $x=0; $x < $surface->width(); $x++) {
|
||||||
|
my $x2 = $surface->width() - $x - 1;
|
||||||
|
$surface->blit( [ $x, 0, 1, $surface->height() ], $new, [ $x2, 0, 1, $surface->height() ] );
|
||||||
|
}
|
||||||
|
return $new;
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
Reference in New Issue
Block a user