Either world or terminal has focus

This commit is contained in:
blinry 2020-11-18 19:21:10 +01:00
parent 96e4c56521
commit b7710e1422
2 changed files with 25 additions and 24 deletions

View file

@ -33,6 +33,8 @@ func _input(event):
if event.is_action_pressed("save"): if event.is_action_pressed("save"):
if text_edit.visible: if text_edit.visible:
save() save()
if has_focus():
var speed = 30 var speed = 30
if event.is_action_pressed("down", true): if event.is_action_pressed("down", true):
player.move(Vector2(0,speed)) player.move(Vector2(0,speed))
@ -238,11 +240,6 @@ func _set_title(new_title):
if title_label: if title_label:
title_label.text = new_title title_label.text = new_title
func _gui_input(event):
if event is InputEventMouseButton and event.is_pressed() and event.button_index == BUTTON_RIGHT:
$PopupMenu.set_position(get_global_mouse_position())
$PopupMenu.popup()
func very_best_sort(a,b): func very_best_sort(a,b):
if a[0] == "." and b[0] != ".": if a[0] == "." and b[0] != ".":
return false return false

View file

@ -10,6 +10,7 @@
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
rect_min_size = Vector2( 0, 142 ) rect_min_size = Vector2( 0, 142 )
focus_mode = 2
theme = ExtResource( 3 ) theme = ExtResource( 3 )
script = ExtResource( 1 ) script = ExtResource( 1 )
__meta__ = { __meta__ = {
@ -19,6 +20,7 @@ __meta__ = {
[node name="Panel" type="Panel" parent="."] [node name="Panel" type="Panel" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
mouse_filter = 1
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
@ -26,6 +28,7 @@ __meta__ = {
[node name="Margin" type="MarginContainer" parent="Panel"] [node name="Margin" type="MarginContainer" parent="Panel"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
mouse_filter = 1
custom_constants/margin_right = 8 custom_constants/margin_right = 8
custom_constants/margin_top = 8 custom_constants/margin_top = 8
custom_constants/margin_left = 8 custom_constants/margin_left = 8
@ -73,6 +76,7 @@ text = "dir"
margin_top = 29.0 margin_top = 29.0
margin_right = 1904.0 margin_right = 1904.0
margin_bottom = 1064.0 margin_bottom = 1064.0
mouse_filter = 1
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3