necra-prototypes/ritual/curved_label.gd
Antonio Dell'Annunziata 5c785e24af
All checks were successful
/ test (push) Successful in 2s
Integrate map and ritual
2025-03-16 16:26:42 +01:00

21 lines
508 B
GDScript

@tool
class_name CurvedLabel
extends Control
@export var curve: Curve
@export var text: String:
set(new_value):
text = new_value
queue_redraw()
@export var enable_rotation: bool = true:
set(new_value):
enable_rotation = new_value
queue_redraw()
func _draw():
var rotation = 0.0
for i in text.length():
draw_char(get_theme_default_font(), Vector2.ZERO + (Vector2.RIGHT * (i*10)), text[i])
rotation += 10.0 if enable_rotation else 0
draw_set_transform(Vector2.ZERO, deg_to_rad(rotation))