Skip to content

Draw a line at some position #17948

Answered by rparrett
elenakrittik asked this question in Q&A
Discussion options

You must be logged in to vote

Within the context of bevy_ui, the easiest way to draw a rectangle is to use a Node with a background color.

I have also seen the following hacks in the wild for drawing cursors:

  • Splitting the text into a before cursor, cursor, and after cursor spans, drawing the cursor as a | character using a special font with a zero-width | glyph.
    (courtesy of bevy_simple_text_input)
  • Duplicating the pre-cursor text, measuring its width, and using that width to position a Node with a background color.
    (courtesy of bevy_editor_prototypes)

i would need to create a new mesh for every different height.

You can create a square rectangle mesh once and use the scale property on Transform to get different h…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by elenakrittik
Comment options

You must be logged in to vote
1 reply
@elenakrittik
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants