36 lines
715 B
GDScript
36 lines
715 B
GDScript
@tool
|
|
extends Button
|
|
|
|
class_name IconButton
|
|
|
|
@export var data: String
|
|
@export var image: Texture:
|
|
set(value):
|
|
image = value
|
|
if is_inside_tree() and has_node("%Texture"):
|
|
$%Texture.texture = image
|
|
@export var images: Array[Texture]
|
|
@export var apply_texture_on_selection: bool = true
|
|
|
|
|
|
func _ready():
|
|
if image != null and has_node("%Texture"):
|
|
$%Texture.texture = image
|
|
|
|
func _on_mouse_entered() -> void:
|
|
TweenFX.stop_all(self)
|
|
scale = Vector2.ONE
|
|
rotation = 0.0
|
|
TweenFX.breathe(self, 1)
|
|
|
|
func _on_mouse_exited() -> void:
|
|
TweenFX.stop_all(self)
|
|
scale = Vector2.ONE
|
|
rotation = 0.0
|
|
|
|
func _on_pressed() -> void:
|
|
TweenFX.stop_all(self)
|
|
scale = Vector2.ONE
|
|
rotation = 0.0
|
|
TweenFX.press_rotate(self)
|