diff options
| author | Jan Tuomi <jan@jantuomi.fi> | 2025-11-21 21:38:49 +0200 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-11-21 21:39:07 +0200 |
| commit | 6824649c8961b8aa695b6be805401fa357a61793 (patch) | |
| tree | 0441c52355be55518cd74a08b363740d78a093df /touch_screen_button.gd | |
| parent | 242dec6cb636be957fe1c13415762f1e204deef7 (diff) | |
Improve map
Diffstat (limited to 'touch_screen_button.gd')
| -rw-r--r-- | touch_screen_button.gd | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/touch_screen_button.gd b/touch_screen_button.gd index 1a84776..b607964 100644 --- a/touch_screen_button.gd +++ b/touch_screen_button.gd @@ -1,10 +1,15 @@ extends TouchScreenButton @export var texture: Texture2D -@export var desktop_visible: bool +@export var inactive_color: Color +@export var active_color: Color -# Called when the node enters the scene tree for the first time. func _ready() -> void: $TextureRect.texture = texture - if not DisplayServer.is_touchscreen_available(): - visible = desktop_visible + $TextureRect/CanvasModulate.color = inactive_color + +func _on_pressed() -> void: + $TextureRect/CanvasModulate.color = active_color + +func _on_released() -> void: + $TextureRect/CanvasModulate.color = inactive_color |
