godot-webrtc-mplayer-testing/scripts/objects/bar.gd

16 lines
350 B
GDScript3
Raw Permalink Normal View History

2021-12-17 17:10:56 -06:00
extends ProgressBar
2021-12-21 17:13:02 -06:00
@export @onready var label = get_node(label) as Label
2021-12-17 17:10:56 -06:00
2021-12-21 17:13:02 -06:00
@onready var font = label.get_theme_default_font()
2021-12-17 17:10:56 -06:00
func _ready():
_on_bar_resized()
func _on_bar_value_changed(value):
label.text = "%d / %d" % [value, max_value]
func _on_bar_resized():
label.visible = rect_size.y > 16
label.rect_size = rect_size / label.rect_scale