deno_tui Label-class
Hello.
I just started testing around with deno_tui and found the DrawObject-Class. How do i actually use this class? Afaik there is no proper documentation to deno_tui at all and especially not for this class specifically.
72 Replies
DrawObject
doesn't do that much by itself, it's used to create TextDrawObject
and BoxDrawObject
which then are used in components to render on the canvas. To build Tui you probably want to use components instead, if you want to create your own components and use them you can take a look at any of the components in src/components
, keep in mind that I'm planning on replacing DrawObjects in the future, I have PR open to do it, will try to finish it as soon as I will have some spare time.My problem is just, that i dont know, what i need to use for achieving my goal. Basically, i want to have blocks which consist of 16x16 pixel (16 rows, 32 columns) to display textures. The texture of each "block" has to be adjustable. Is there a component that does this?
there's a way to workaround this using styles, but that's not good DX at all, it seems like your usecase is actually in need of custom
DrawObject
I was planning on implementing ShapePainter
in my PR which is essentially what you need, but I didn't even start working on it :/
@realdna it totally escaped my head 🤦♂️
you could just use Label
component for thatessentially you could just convert the texture into a string and pass it to the label
my brain isn't braining
I tried that but with a textbox and it didnt work
And i gave up
I think the label is gonna work
Let me try in a few minutes
https://deno.land/x/tui@2.1.1/src/components/mod.ts
you should check that for simple component descriptions
textbox is a multiline text input :p
Lmao
Me being braindead
Sorry
I didnt want to waste your time
you didn't
tui definitely needs better docs
I just tried that method, but it doesnt seem to work properly for me
This is my code:
The outcome in terminal:
When i manually print the text (textures.stone) reading it from the file:
Okay, I think I know what's going wrong here, could you file an issue about it please?
Just created the issue: https://github.com/Im-Beast/deno_tui/issues/31