1.1.3 • Published 7 years ago

text-maze-render v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

Text Maze Render

Rendering functions for mazes created with the text-maze package. Rendering is via the HTML Canvas API.

See it in use: https://littlesystem.com/maze

Install

npm install --save text-maze-render

Usage

Render a text maze with either the blocky, bordered or walled rendering function.

var tm  = require('text-maze');
var tmr = require('text-maze-render');

var maze = tm("I don't know half of you half as well as I should like.");

tmr.blocky(maze.maze, {
    cellSize: maze.cellSize,
    endpoints: maze.endpoints,
    showText: true,
    showSolution: true
});

Put a canvas tag in your HTML with an id of text-maze.

<canvas id="text-maze">

Bundle your code with something like browserify.

browserify code.js -o bundle.js

Load the bundle in your HTML.

<script src="path/to/bundle.js"></script>