From 769413468e88acba1a180baa0113139d929a3b9f Mon Sep 17 00:00:00 2001 From: liam4 Date: Mon, 3 Jul 2017 18:59:57 -0300 Subject: A long-due cleanup + examples + things ..Obviously this breaks old things (particularly, see changes in FocusElement). --- examples/label.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/label.js (limited to 'examples/label.js') diff --git a/examples/label.js b/examples/label.js new file mode 100644 index 0000000..b8992d2 --- /dev/null +++ b/examples/label.js @@ -0,0 +1,22 @@ +// An example of basic label usage. + +const ansi = require('../util/ansi') +const Label = require('../ui/Label') + +const label1 = new Label('Hello, world!') +const label2 = new Label('I love labels.') + +label1.x = 3 +label1.y = 2 + +label2.x = label1.x +label2.y = label1.y + 1 + +process.stdout.write(ansi.clearScreen()) +label1.drawTo(process.stdout) +label2.drawTo(process.stdout) + +process.stdin.once('data', () => { + process.stdout.write(ansi.clearScreen()) + process.exit(0) +}) -- cgit 1.3.0-6-gf8a5