add game menu
This commit was merged in pull request #19.
This commit is contained in:
29
core/game_menu/arrow_button.gd
Normal file
29
core/game_menu/arrow_button.gd
Normal file
@@ -0,0 +1,29 @@
|
||||
@tool
|
||||
extends Control
|
||||
|
||||
class_name ArrowButton
|
||||
|
||||
signal on_pressed
|
||||
|
||||
@export var image: Texture:
|
||||
set(value):
|
||||
image = value
|
||||
if is_inside_tree() and has_node("%Texture"):
|
||||
$%Texture.texture = image
|
||||
|
||||
@export var flip_h: bool = false:
|
||||
set(value):
|
||||
flip_h = value
|
||||
if is_inside_tree() and has_node("%Texture"):
|
||||
if $%Texture != null:
|
||||
$%Texture.flip_h = flip_h
|
||||
|
||||
func _ready():
|
||||
if image != null and has_node("%Texture"):
|
||||
$%Texture.texture = image
|
||||
$%Texture.flip_h = flip_h
|
||||
|
||||
|
||||
func _on_gui_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
on_pressed.emit()
|
||||
Reference in New Issue
Block a user