NAME

Game::TextMapper::Mapper - a text map parser and builder

SYNOPSIS

use Modern::Perl;
use Game::TextMapper::Mapper::Hex;
my $map = <<EOT;
0101 forest
include default.txt
EOT
my $svg = Game::TextMapper::Mapper::Hex->new(dist_dir => 'share')
  ->initialize($map)
  ->svg();
print $svg;

DESCRIPTION

This class knows how to parse a text containing a map description into SVG definitions, and regions. Once the map is built, this class knows how to generate the SVG for the entire map.

The details depend on whether the map is a hex map or a square map. You should use the appropriate class instead of this one: Game::TextMapper::Mapper::Hex or Game::TextMapper::Mapper::Square.

ATTRIBUTES

dist_dir

You need to pass this during instantiation so that the mapper knows where to find files it needs to include.

METHODS

initialize($map)

Call this to load a map into the mapper.

svg()

This method generates the SVG once the map is initialized.

SEE ALSO

Game::TextMapper::Mapper::Hex is for hex maps.

Game::TextMapper::Mapper::Square is for square maps.