Game::TextMapper::Point - a point on the map
This is a simple class to hold points. Points have coordinates and know how to print them.
x, y, z are coordinates.
x
y
z
type, label, size are used to draw the SVG. These are used by the actual implementations, Game::TextMapper::Point::Hex and Game::TextMapper::Point::Square.
type
label
size
map is a reference to Game::TextMapper::Mapper from which to get text_attributes (for the coordinates), and both label_attributes and glow_attributes (for the label).
map
text_attributes
label_attributes
glow_attributes
Returns "(1,2,3)" or "(1,2)" depending on whether the z coordinate is defined or not; use this for log output.
True if all three coordinates match.
Return -1, 0, or 1 depending on the three coordinates.
Return "1,1,1" or "1,1" for coordinates in scalar context, depending on whether the z coordinate is defined or not, or it returns the three coordinates in list context.
Return "0101" or "-01-01" for coordinates. Often this what we want in text.
These methods must be implemented by derived classes. The $offset argument is an array with the offsets to add to the y based on z coordinate. The idea is that if we have two dungeon levels, for example, and we want to generate a single SVG document, then the first level is at the top of the page, as usual, and the next level is further down on the page: all the y coordinates were increased by the offset.
This returns an SVG fragment, a string with a polygon or rect element, for example.
polygon
rect
This is used for the group containing the regions in the resulting SVG.
This returns an SVG fragment, a string with a use element.
use
This is used for the group containing the background colours in the resulting SVG.
This returns an SVG fragment, a string with a text element.
text
This is used for the group containing the coordinates in the resulting SVG.
This returns an SVG fragment, a string with a g element containing two text elements, and possibly an a element: the "glow", the label itself, and possibly a link to the URL.
g
a
This is used for g#labels (the group containing the labels) in the resulting SVG.
g#labels
Game::TextMapper::Mapper uses this class. Internally, it calls make_region which is implemented by either Game::TextMapper::Mapper::Hex or Game::TextMapper::Mapper::Square. Depending on the implementation, Game::TextMapper::Point::Hex or Game::TextMapper::Point::Square are used to implement this class.
make_region
To install Game::TextMapper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Game::TextMapper
CPAN shell
perl -MCPAN -e shell install Game::TextMapper
For more information on module installation, please visit the detailed CPAN module installation guide.