Skip to content

Iliakis-M/RGL-II

Folders and files

NameName
Last commit message
Last commit date
Apr 14, 2020
Feb 29, 2020
Jul 29, 2020
Jul 29, 2020
Jul 29, 2020
Jul 29, 2020
Mar 2, 2020
Mar 11, 2020
Feb 29, 2020
Feb 29, 2020
Jul 28, 2020
Mar 2, 2020
Mar 2, 2020
Mar 2, 2020
Mar 2, 2020
Jul 28, 2020
Mar 2, 2020

Repository files navigation

RGL

An engine for RogueLike games.
Or colored console text.

Restrictions

  1. RGL~_Tile field manipulates the original RGLTile-like class, meaning that if you have multiple RGL instances using the same RGL~_Tile reference, you cannot have different mappings for each. Instead, reload the module or copy/clone that class.
  2. RGLTiles once bound to an RGLMap, they belong to that map exclusively, clone if needed.

Mappings

Color mappings can be customized, just make sure you always provide the JSON to the end-user.
Style mappings cannot be customized!

Formatting instructions here

Identifying the Keys

Since RGL#bind turns the provided stream (process.stdin by default) into a RAW TTY stream, In order to identify keypress combinations like CTRL - C and use them in your codes, you can use the builtin rgl keys utility which will provide several info about the input.

Usage

import * as rgl from "rgl";

/**
 * mappings_color, mappings_background : Map<number, Types.Mapping>
 *
 * autoconfig : Configures I/O-bindings and mapping automatically.
 */
const inst = rgl.RGL.create(autoconfig = false, mappings_color, mappings_background);

inst.bind(process.stdin, process.stdout, process.stderr);