Add FlipSurface function
This commit is contained in:
parent
feca9d5c11
commit
e1d0817a5b
|
|
@ -268,4 +268,18 @@ sub LoadVirtualSprite {
|
|||
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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue