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.

pjals

Feb 29, 2020, 06:14 pm #1 Last Edit: Mar 06, 2020, 08:26 am by pjals Reason: imgur
Issue 1: After looking at your code, I noticed this has limited color support, please add more color support, thanks!

Issue 2: It is all the time printing A with a brown background and green text, I'm very disappointed.

Here is my code: https://pastebin.com/BrC0AmBS

Here is a image: https://imgur.com/KM6NWtU
hi i am T79, bye

Wojbie

1) Can you share example of code you are using to interact with this API? Cause it fully supports all colors and pallettes normal term does.

2) If you see `A with a brown background and green text` that means you are doing something wrong.

The link you posted don't work..

Wojbie

Ok thank you for editing the message with updated urls. And see the problem. You don't realize that a plethora glasses canvas has limited size it can be. At scale of 2 (and with your program modified to be 300x200 instead of 600x200) while the terminal inside is claims to be 300x200 that you can only see is about 64x24 characters.

Example i described below:


As for your 'too long time without yeld' erroring issue - i never considered someone would try making big ass terminal and then not try making smaller ones first before reporting error. It simply errors during term building phase and all you are left with is debug pattern. Using term sizes that actually fit inside canvas are suggested.

Hope that explains how to correctly use this api?

As side note here is image using a different pallettes then default to showcase that this API does support all the colors.

QuickMuffin8782

SO COOL! I would love that, hopefully, I can make my own glasses which actually helps with finding your waypoint. It'll have a compass and such... I really like it! Good job!
GOTTA GO FAST!!!!