npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

roguelikeboard

v0.0.0

Published

A simple react.js component for rendering ASCII inspired roguelike boards on the web

Downloads

5

Readme

roguelikeboard.jsx

roguelikeboard.jsx is a simple react.js component for rendering ASCII inspired roguelike boards on the web

####Installation First grab the source via npm install roguelikeboard, or download the project from github and snag src/roguelikeboard.jsx

Next, include roguelikeboard.jsx into your project. It supports require.js, browserify, or no dependency management system. (i.e. React should be a global)

###Setup In your parent component you should add the board to your render() method, and maintain a ref to it.

var RoguelikeBoard = require('roguelikeboard');
React.createClass({
        render: function() {
                return (
                    <RoguelikeBoard ref="roguelikeboard" />
                )
            }
})

###API There are a few different operations you can perform. Here they all are.

roguelikeboard.setViewportSize(widthInTiles, heightInTiles) [required]
roguelikeboard.setTileMap(2dArrayOfKeys) [required]
roguelikeboard.setCSSClassForTile(key, cssClassName)
roguelikeboard.setCSSClassForObject(key, cassClassName)
roguelikeboard.setObjects(array)
roguelikeboard.setCameraPosition(x, y)

Before jumping into details, there are a couple of concepts to explain.

####TileMaps vs Objects The tilemap is the "level" of your board. It is the background. It is assumed to be a 2D array, e.g.

var map = [[0,0,0],
           [0,1,0],
           [0,0,0]];

Objects are the players, items, monsters, in your game. It is assumed to be an array with objects that contain a x y and type properties.

var objects = [{x: 0, y: 0, type: 'player'}];

We could then call setObjects(objects), and setTileMap(map) on our ref to render.

####Symbols and colors To render symbols and colors we just use regular css. In order to do this we need to associate our tiles, and objects with css classes. We can do this with setCSSClassForObject('player', 'symbol-player') and setCSSClassForTile(0, 'symbol-grass').

Now we simply create some CSS to style these items.

.symbol-tree {
    background-color: green;
    color: green;
}
.symbol-tree:after {
    content: " ";
}
.symbol-grass {
    background-color: green;
    color: #ffffff;
}
.symbol-grass:after {
    content: "@";
}

You can also style .rb-renderer with styles that should affect the entire board such as a font. Speaking of font, make sure you use a fixed-width font, or things will get pretty ugly. I've used Courier New in the example as it is a common fixed-width font included in popular operating systems.

####Running the demo

npm install
make rundemo
http://127.0.0.1:3006