From 48c2854fa2c3c3f7d1b31fe89cec6b6b9a57bc26 Mon Sep 17 00:00:00 2001 From: Ryan Shepherd Date: Mon, 1 Oct 2018 22:53:30 -0400 Subject: [PATCH] Fix sprite flip property --- PerlRPG/Drawing.pm | 4 +++- issues.txt | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/PerlRPG/Drawing.pm b/PerlRPG/Drawing.pm index 32c36fa..31863d8 100644 --- a/PerlRPG/Drawing.pm +++ b/PerlRPG/Drawing.pm @@ -167,7 +167,9 @@ sub FlipSurface { for(my $y = 0; $y < $src->height(); $y++) { for(my $x = 0; $x < $w; $x++) { my $pixel = $src->get_pixel( $y, $x ); - $dst->set_pixel($y, $w-($x+1), $pixel); + my $c = SDL::Video::get_RGBA( $src->format(), $pixel ); + my $c2 = SDL::Video::map_RGBA( $dst->format(), @$c ); + $dst->set_pixel($y, $w-($x+1), $c2); } } diff --git a/issues.txt b/issues.txt index bc15be3..5fefec5 100644 --- a/issues.txt +++ b/issues.txt @@ -1,2 +1 @@ -ShowSprite with flip option doesn't work .vs constructed animated sprites don't respect source image's alpha channel