tool
extends Button

export(Color) var color_normal: Color setget set_normal_color
export(Color) var color_hovered: Color
export(Color) var color_pressed: Color


func _ready():
	if not Engine.is_editor_hint():
		connect("mouse_entered", self, "_on_mouse_entered")
		connect("mouse_exited", self, "_on_mouse_exited")
		connect("button_down", self, "_on_button_down")
		connect("button_up", self, "_on_button_up")


func set_normal_color(c: Color) -> void:
	color_normal = c
	if Engine.is_editor_hint():
		set_modulate(color_normal)


func _on_mouse_entered() -> void:
	set_modulate(color_hovered)


func _on_mouse_exited() -> void:
	set_modulate(color_normal)


func _on_button_down() -> void:
	set_modulate(color_pressed)


func _on_button_up() -> void:
	set_modulate(color_hovered)
