From ca0b66b1ad5c1a9f6d74e4aca95e4044d08b6df1 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 8 Oct 2014 17:22:41 -0400 Subject: docs --- lib/Games/NES/SpriteMaker.pm | 69 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/lib/Games/NES/SpriteMaker.pm b/lib/Games/NES/SpriteMaker.pm index 65c11bd..c1c6250 100644 --- a/lib/Games/NES/SpriteMaker.pm +++ b/lib/Games/NES/SpriteMaker.pm @@ -4,6 +4,38 @@ use warnings; use Image::PNM; +=head1 SYNOPSIS + + use Games::NES::SpriteMaker; + + open my $fh, '>', 'sprites.chr'; + my $chr = Games::NES::SpriteMaker::image_to_sprite('spritemap.pgm'); + $fh->print($chr); + $fh->close; + +=head1 DESCRIPTION + +This module contains useful functions for manipulating images in the PNM format +in order to create and modify sprite data (CHR-ROM banks) in NES roms. The idea +is that drawing sprites is much easier in a real graphics editor, and then you +can save the image as a .pbm/.pgm/.ppm file and convert it into sprite data +directly, rather than having to edit sprites in a hex editor. + +Right now, the capabilities are pretty limited, but I'm open to adding more +functionality as it becomes useful. + +=cut + +=func image_to_sprite($data, %opts) + +Converts PNM data to CHR-ROM data. C<$data> can either be a filename or a +scalar reference which is a reference to a string containing PNM-format data. +C<%opts> is a hash of options for how to generate the data. Currently the only +option is C, which determines the size of the .chr file to generate. +It defaults to C<8192>. + +=cut + sub image_to_sprite { my ($data, %opts) = @_; @@ -71,4 +103,41 @@ sub _color_key { return "$pixel->[0];$pixel->[1];$pixel->[2]"; } +=head1 BUGS + +Please report any bugs to GitHub Issues at +L. + +=head1 SEE ALSO + +=head1 SUPPORT + +You can find this documentation for this module with the perldoc command. + + perldoc Games::NES::SpriteMaker + +You can also look for information at: + +=over 4 + +=item * MetaCPAN + +L + +=item * RT: CPAN's request tracker + +L + +=item * Github + +L + +=item * CPAN Ratings + +L + +=back + +=cut + 1; -- cgit v1.2.3-54-g00ecf