@tool extends Panel @export var texture: Texture2D: set(value): texture = value $TouchScreenButton.texture_normal = value _on_resized() @export var label: String: set(value): label = value $Label.text = value @export var action: StringName = "": set(value): action = value $TouchScreenButton.action = value func _ready() -> void: _on_resized() func _on_resized() -> void: $TouchScreenButton.shape.size = size var texture_size := Vector2.ZERO if texture: texture_size = texture.get_size() $TouchScreenButton.position = Vector2( (size.x - texture_size.x) / 2, (size.y - texture_size.y) / 2 ) $Label.size = size func _on_touch_screen_button_pressed() -> void: modulate = Color(0.5, 0.5, 0.5, 1.0) func _on_touch_screen_button_released() -> void: modulate = Color(1.0, 1.0, 1.0, 1.0)