-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirEdit.gd
More file actions
40 lines (31 loc) · 929 Bytes
/
DirEdit.gd
File metadata and controls
40 lines (31 loc) · 929 Bytes
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
extends TextEdit
var mouseOnThis = false
# Called when the node enters the scene tree for the first time.
func _ready():
text = get_parent().currentDirectory
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if(Input.get_mouse_mode() == 2):
release_focus()
pass
func _on_gui_input(event):
# Set directory to input
if(event.get_class() == "InputEventKey"):
if(event.pressed):
# If enter key
if(event.keycode == 4194309):
text = text.replace("\n", "")
if(text.right(1) != "/"):
text += "/"
get_parent().currentDirectory = text
release_focus()
get_parent().update_dir_contents(text)
print("cd" + text)
func _on_mouse_entered():
mouseOnThis = true
func _on_mouse_exited():
mouseOnThis = false
func _input(event):
if event is InputEventMouseButton and mouseOnThis == false:
release_focus()