-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport_phiator.gd
More file actions
30 lines (29 loc) · 1.13 KB
/
export_phiator.gd
File metadata and controls
30 lines (29 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
extends PanelContainer
var style = true
var pressed = false
func _ready() -> void:
pass
func _process(_delta: float) -> void:
if style:
if pressed:
add_theme_stylebox_override("panel", preload("res://button_pressed_stylebox.tres"))
else:
add_theme_stylebox_override("panel", preload("res://button_stylebox.tres"))
style = false
func _gui_input(event: InputEvent) -> void:
if not pressed and event is InputEventMouseMotion:
if Rect2(Vector2.ZERO, size).has_point(event.position):
add_theme_stylebox_override("panel", preload("res://button_pressed_stylebox.tres"))
else:
add_theme_stylebox_override("panel", preload("res://button_stylebox.tres"))
elif not pressed and event is InputEventMouseButton and event.button_index == MouseButton.MOUSE_BUTTON_LEFT:
if event.is_pressed():
add_theme_stylebox_override("panel", preload("res://button_pressed_stylebox.tres"))
elif event.is_released():
if Rect2(Vector2.ZERO, size).has_point(event.position):
$"../RPE".pressed = false
$"../RPE".style = true
pressed = true
style = true
else:
add_theme_stylebox_override("panel", preload("res://button_stylebox.tres"))