NAME

Games::Maze::SVG - Build mazes in SVG.

VERSION

Version 0.90

SYNOPSIS

Games::Maze::SVG uses the Games::Maze module to create mazes in SVG.

use Games::Maze::SVG;

my $foo = Games::Maze::SVG->new();
...

See Games::Maze::SVG::Manual for more information on using the module.

FUNCTIONS

new( $type, %parms )

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

wallform

String naming the wall format. Legal values are bevel, round, roundcorners, and straight. Not all formats work with all maze shapes.

crumb

String describing the breadcrumb design. Legal values are dash, dot, line, and none

dir

Directory in which to find the ecmascript for the maze interactivity. Should either be relative, or in URL form.

interactive

This parameter determines if the maze will be interactive. If the value of the parameter is true (1), the appropriate scripting and support is written into the SVG. If the parameter is omitted or false, no interactive support is provided.

cols

The number of columns used in creating the maze. Default value is 12.

rows

The number of rows used in creating the maze. Default value is 12.

startcol

The column where the entry is found. Default value is random.

endcol

The column where the exit is found. Default value is random.

$m->init_object( %parms )

Initializes the maze object with the default values for all mazes. The derived classes should call this method in their constructors.

Returns the initial data members as a list.

$m->set_interactive()

Method makes the maze interactive.

Returns a reference to self for chaining.

$m->set_breadcrumb( $bcs )

$bcs

String specifying the breadcrumb style. Generates an exception if the breadcrumb style is not recognized.

Returns a reference to self for chaining.

$m->get_crumbstyle()

Returns the CSS style for the breadcrumb.

$m->get_script()

Method that returns the path to the interactivity script.

$m->to_string()

Method that converts the current maze into an SVG string.

$m->toString()

Alias for to_string to deal with inconsistent name from earlier versions.

$m->make_board_array( $rows )

Build a two-dimensional array of integers that maps the board from the two dimensional matrix of wall descriptions.

$m->get_script_list()

Returns a list of script URLs that will be needed by the interactive maze.

$m->build_all_script()

Generate the full set of script sections for the maze.

$m->build_board_element( $rows, $xp, $yp, $xe, $ye )

Create the element that describes the board.

$rows

reference to an array of rows.

$xp, $yp

Starting position

$xe, $ye

Ending position

$m->build_control_panel( $startx, $height )

Create the displayable control panel

$startx

the starting x coordinate for the panel

$height

the height of the maze