20 lines
490 B
GDScript
20 lines
490 B
GDScript
extends Area2D
|
|
class_name Clickable
|
|
|
|
|
|
signal on_clicked
|
|
|
|
|
|
func _on_mouse_entered() -> void:
|
|
Input.set_default_cursor_shape(Input.CursorShape.CURSOR_POINTING_HAND)
|
|
|
|
|
|
func _on_mouse_exited() -> void:
|
|
Input.set_default_cursor_shape(Input.CursorShape.CURSOR_ARROW)
|
|
|
|
|
|
func _on_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
|
|
if event is InputEventMouseButton and event.is_pressed():
|
|
Input.set_default_cursor_shape(Input.CursorShape.CURSOR_ARROW)
|
|
on_clicked.emit()
|