-
Notifications
You must be signed in to change notification settings - Fork 0
/
Controlz.gd
51 lines (34 loc) · 1.06 KB
/
Controlz.gd
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _ready():
hide_menu()
func _input(event):
if event.is_action_pressed("ui_cancel"):
print("Toggle menu key pressed")
toggle_menu()
func toggle_menu():
if self.visible:
hide_menu()
else:
show_menu()
func show_menu():
print("Showing menu") # Debug statement
self.show()
call_deferred("set_mouse_mode_visible") # Call set_mouse_mode_visible with a delay
func hide_menu():
print("Hiding menu") # Debug statement
self.hide()
call_deferred("set_mouse_mode_captured") # Call set_mouse_mode_captured with a delay
func set_mouse_mode_visible():
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) # Show the mouse cursor
func set_mouse_mode_captured():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) # Capture the mouse cursor
func _on_OptionButton_pressed():
pass # Replace with function body.
func _on_CheckBox_pressed():
print("checkbox pressed i guess?")