An engine for RogueLike games.
Or colored console text.
RGL~_Tile
field manipulates the originalRGLTile
-like class, meaning that if you have multipleRGL
instances using the sameRGL~_Tile
reference, you cannot have different mappings for each. Instead, reload the module or copy/clone that class.RGLTile
s once bound to anRGLMap
, they belong to that map exclusively, clone if needed.
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
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.
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);