0 votes

Hey everyone!

I'm creating a diablo style chat box and am curious if it's possible to draw a background color behind a richt text label.

Infact, here is the script applied to my RichTextLabel:

extends RichTextLabel



func _ready():
    pass

func _draw():
    var r = Rect2( Vector2(0, 0), get_size() )
    draw_rect(r, Color(0, 0, 0, 1) )
    print("drawing for my rtl")

This actually draws the black background, but it draws it infront of the text.

Example:
enter image description here

I'm curious, is it possible to somehow re-order the draw order on a RichTextLabel, so the background is behind the text instead?

in Engine by (314 points)

You could have another background node above your text in the scene tree, but it requires you to have two nodes for this.

Yeah @zylann I figured I'd just do a separate background panel behind the RTL, works fine, thx!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.