Draw a line at some position #17948
-
|
I'm making a text prompt and i need to draw the cursor. I tried searching but mostly to no avail. I tried using a low-width white rectangle as a cursor but then noticed that i would need to create a new mesh for every different height. (I also couldn't find how to reliably calculate the (visual/pixel/screen) position of a character in a Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Within the context of I have also seen the following hacks in the wild for drawing cursors:
You can create a square rectangle mesh once and use the
There is TextLayoutInfo. Beware |
Beta Was this translation helpful? Give feedback.
-
|
You don't want to spawn a node or separate entity for just a cursor probably, the simplest method is to draw it using an extraction function. |
Beta Was this translation helpful? Give feedback.
Within the context of
bevy_ui, the easiest way to draw a rectangle is to use aNodewith a background color.I have also seen the following hacks in the wild for drawing cursors:
before cursor,cursor, andafter cursorspans, drawing the cursor as a|character using a special font with a zero-width|glyph.(courtesy of
bevy_simple_text_input)Nodewith a background color.(courtesy of
bevy_editor_prototypes)You can create a square rectangle mesh once and use the
scaleproperty onTransformto get different h…