| Games-Maze-SVG documentation | Contained in the Games-Maze-SVG distribution. |
Games::Maze::SVG::Hex - Build hexagonal mazes in SVG.
Version 0.71
Games::Maze::SVG::Hex uses the Games::Maze module to create hexagonal mazes in SVG.
use Games::Maze::SVG;
my $foo = Games::Maze::SVG->new( 'Hex' );
...
Create a new Games::Maze::SVG object. Supports the following named parameters:
Takes one positional parameter that is the maze type: Rect, RectHex, or Hex
String naming the wall format. Legal values are bevel, round, roundcorners, and straight.
String describing the breadcrumb design. Legal values are dash, dot, line, and none
The size of the tiles in the X direction.
The size of the tiles in the Y direction.
Directory in which to find the ecmascript for the maze interactivity. Should either be relative, or in URL form.
Method returns true.
Method returns true.
Convert the supplied x and y coordinates into the appropriate real coordinates for a the position of the exit sign.
returns a two element list containing (x, y).
G. Wade Johnson, <wade@anomaly.org>
Please report any bugs or feature requests to
bug-game-maze-svg@rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Game-Maze-SVG.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
Thanks go to Valen Johnson and Jason Wood for extensive test play of the mazes.
Copyright 2004-2006 G. Wade Johnson, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Games-Maze-SVG documentation | Contained in the Games-Maze-SVG distribution. |
# SVG maze output # Performs transformation, cleanup, and printing of output of Games::Maze package Games::Maze::SVG::Hex; use base Games::Maze::SVG::HexCells; use Carp; use Games::Maze; use strict; use warnings;
our $VERSION = 0.71;
# ---------------------------------------------- # Subroutines
sub new { my $class = shift; my $obj = Games::Maze::SVG::HexCells->new( @_ ); $obj->{mazeparms}->{form} = 'Hexagon'; # rebless into this class. return bless $obj, $class; }
sub is_hex { return 1; }
sub is_hex_shaped { return 1; }
sub convert_sign_position { my $self = shift; my ($x, $y) = @_; $x *= $self->dx(); $y *= $self->dy(); # left or right if($x > $self->{width}/2) { $x += $self->dx(); } else { $x -= $self->dx(); } # adjust bottom if($y > $self->{height}/2) { $y += 3*$self->dy(); } else { $y -= $self->dy(); } return ($x, $y); }
1;