diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-08 10:41:41 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-08 10:41:41 -0400 |
commit | d6de63eafdb806fd3c1e4cf9ae1a65105c0d0d8d (patch) | |
tree | 4ee4ea59f914d5fa53b0d2063c1b4c1b6fb6edc4 | |
parent | af3727dbae90324bf48e69735823c352b7348762 (diff) | |
download | games-nes-spritemaker-d6de63eafdb806fd3c1e4cf9ae1a65105c0d0d8d.tar.gz games-nes-spritemaker-d6de63eafdb806fd3c1e4cf9ae1a65105c0d0d8d.zip |
generate the entire chr data
-rw-r--r-- | lib/Games/NES/SpriteMaker.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Games/NES/SpriteMaker.pm b/lib/Games/NES/SpriteMaker.pm index 3b4168e..7582338 100644 --- a/lib/Games/NES/SpriteMaker.pm +++ b/lib/Games/NES/SpriteMaker.pm @@ -5,7 +5,9 @@ use warnings; use Image::PNM; sub image_to_sprite { - my ($data) = @_; + my ($data, %opts) = @_; + + $opts{rom_size} ||= 8192; my $image = Image::PNM->new($data); if ($image->width % 8 || $image->height % 8) { @@ -41,7 +43,7 @@ sub image_to_sprite { } } - return $bytes; + return $bytes . ("\x00" x ($opts{rom_size} - length($bytes))); } sub _get_palette_colors { |