summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-10-09 11:36:17 -0400
committerJesse Luehrs <doy@tozt.net>2014-10-09 11:36:17 -0400
commita9049df5e952cf0a1aa143580b8935decf64b7fc (patch)
treeaf8adb43339c018a1164c072492b75e9497d3b0b
parentb94d485b537a2f9903c2dc7ff0c0c2a47742eff4 (diff)
downloadgames-nes-spritemaker-a9049df5e952cf0a1aa143580b8935decf64b7fc.tar.gz
games-nes-spritemaker-a9049df5e952cf0a1aa143580b8935decf64b7fc.zip
white is max, not always 1
-rw-r--r--lib/Games/NES/SpriteMaker.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Games/NES/SpriteMaker.pm b/lib/Games/NES/SpriteMaker.pm
index 4647303..c6a69bd 100644
--- a/lib/Games/NES/SpriteMaker.pm
+++ b/lib/Games/NES/SpriteMaker.pm
@@ -85,7 +85,8 @@ sub image_to_sprite {
sub _get_palette_colors {
my ($image) = @_;
- my %unique_values = ("1;1;1" => 0);
+ my $max = $image->max_pixel_value;
+ my %unique_values = ("$max;$max;$max" => 0);
my $idx = 1;
for my $row (0..$image->height - 1) {
for my $col (0..$image->width - 1) {