CanvasTerm - API for making term objects on Plethora Overlay glasses

Started by Wojbie, Jan 11, 2020, 01:39 am

Previous topic - Next topic

Wojbie

I am proud to present: CanvasTerm.

With this lovely API you and anyone you know can easily draw term-compatible objects on Plethora Overlay glasses! Have all conveniences of neural interface combined with ability to see term output at a glance of pocket! Easily redirect term to any canvas you want to.



https://pastebin.com/HG7CQhxH
Usage: (requires loading using require)
Code Select
term = canvasTerm.create( parentObject, offsetX, offsetX, nWidth, nHeight, nScale, bStartVisible, bFrameCursor )
parentObject -- should be a 2d canvas object like canvas(), canvas3d().create().addFrame() or addGroup() made on any of those.
offsetx, offsety -- coordinates to start drawing terminal on provided object
nWidth, nHeight -- size of terminal in characters.
nScale -- number specifying scale - 0.1-3 . Scales other then in this range can be unreadable or not fit in canvas size.
bStartVisible -- boolean - should term start visible or not. changed later using .setVisible() method
bFrameCursor -- boolean - additional frame around current cursor position - ignores CursorBlink status - useful for debugging.

Created object implements all term methods and additionally:
term.setVisible() -- turn terminal visible or not
term.redraw() -- force redraw
term.reposition( nNewOffsetX, nNewOffsetY, nNewWidth, nNewHeight, nNewScale, newParent ) -- Allows to change terminal properties. if you only want to change specific ones just provide nil to those staying same ex: to change scale do .reposition( nil, nil, nil, nil, nNewScale)
term.blinker() -- function that causes Cursor to blink. By default cursor don't blink. If you want to cause it to blink simply call this function every 0.1 sec or more often (implement it into your event loop) and you will get blinking cursor effect synchronized with all other CC cursors.