1.0.1 • Published 3 years ago

modular-console v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Modular Console

Modular Console is a package that hopefully makes it easy to make a UI system.

Features

Display

A very simple text display, but useful for changing values.

var ui = require("modular-console")
var d = new ui.Display({
	"You currently have $ dollars.":57, //Prints "You have 57 dollars."
	"You are a $":"Needy man" //"You are a needy man"
})
setTimeout(()=>{
	d.setItem(0, 500000) //Upon redrawing, it shows you have that big amount of money.
	d.setItem(1,"Celebrity")
	d.draw(true) //True so it clears the screen.
},2500)
d.draw(true)

Modular UI

Allows you to make a UI with multiple different parts.

var ui = require("modular-console")
var d = new ui.Display({
	"dolor:$":"sit amet"
})
var u = new ui.ModularUI([
	"Lorem Ipsum",	//Prints text "Lorem Ipsum" when drawn.
	d,				//Draws the display component labeled d.
	"More text!"	//I bet you know what this does.
])
u.draw()
/*
Lorem Ipsum
dolor:sit amet
More text!
*/

Game Boards

These are by far the most experimental and buggy. They let you draw with pixels from a board.

var ui = require("modular-console")
var board = new ui.GameBoard()
board.grid = [
	["red","green","blue"],
	["cyan","magenta","yellow"]
]
board.draw()

Sometimes a markdown engine won't show this right. It's an HTML version of what the code does. If it shows wrong, here's a table: |red|green|blue| |---|-----|----| |cyan|magenta|yellow|

(Some markdown viewers also get this messed up. You get the point.)