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)
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

#1
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!
"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
linktr.ee/quickmuffin8782

poisoned

Oh Yeah, this was one of the things i really wanted.

BAD ASS Terminal, colorfoul.

Very nice - i will directly have a try!

poisoned

oh man....Plethora is minecraft 12.2 only....:0(

do u see any other options, i could use?
"Connected Glass" or sth else from MC 1.16.5?

Wojbie

Quote from: poisoned on Mar 19, 2021, 10:44 PMdo u see any other options, i could use?
"Connected Glass" or sth else from MC 1.16.5?

I have sadly not seen any mods that would implement some canvas-like system in 1.16.5 yet. If one shows up i will update this to support it too.

poisoned

Could you explain the canvas system further u need for it?

Edit: would it be a could thing to return to 12.2?
My focus definitivly is on cc....

Wojbie

Quote from: poisoned on Mar 20, 2021, 09:36 PMCould you explain the canvas system further u need for it?
Something similar to plethora overlay glasses. https://plethora.madefor.cc/items/module-glasses.html
Or open peripheral terminal glasses. https://ftbwiki.org/Terminal_Glasses
There is even Open Glasses for OC. https://www.curseforge.com/minecraft/mc-mods/openglasses
But again none of those are for 1.16.4/5

Quote from: poisoned on Mar 20, 2021, 09:36 PMdit: would it be a could thing to return to 12.2?
My focus definitivly is on cc....
Personally i prefer playing on 1.16.4 cause its more up to date but if you want all peripheral mods you sure can go back.
Otherwise there is great peripheral mod for 1.16.4 https://github.com/Seniorendi/AdvancedPeripherals
If you really want overlay glasses you can suggest it there?

poisoned


Wojbie

Quote from: poisoned on Mar 20, 2021, 11:01 PMThank you - i will have a look at it.
:0)
In fact since we last talked https://github.com/Seniorendi/AdvancedPeripherals did add peripheral glasses. They are a bit raw and basic but i could implement this on them when i find some time one of those days. No promises tho.

Just poking you in case you missed that.

poisoned

yo - i missed that....^^


Quote from: Wojbie on May 11, 2021, 11:45 PM
Quote from: poisoned on Mar 20, 2021, 11:01 PMThank you - i will have a look at it.
:0)
In fact since we last talked https://github.com/Seniorendi/AdvancedPeripherals did add peripheral glasses. They are a bit raw and basic but i could implement this on them when i find some time one of those days. No promises tho.

Just poking you in case you missed that.