Add a close button to the text editor

This commit is contained in:
Sebastian Morr 2020-09-22 15:55:01 +02:00
parent 764714b24e
commit a9f096636a
2 changed files with 21 additions and 1 deletions

View file

@ -35,6 +35,10 @@ func open(filename):
func save():
var fixme_path = game.tmp_prefix+"/active/"
game.write_file(fixme_path+path, text)
_client_connection.disconnect_from_host()
close()
func close():
if _client_connection.is_connected_to_host():
_client_connection.disconnect_from_host()
text = ""
hide()

View file

@ -30,4 +30,20 @@ text = "Save"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CloseButton" type="Button" parent="."]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -50.0
margin_top = 12.0
margin_right = -10.0
margin_bottom = 52.0
focus_mode = 0
custom_fonts/font = ExtResource( 1 )
enabled_focus_mode = 0
text = "x"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="SaveButton" to="." method="save"]
[connection signal="pressed" from="CloseButton" to="." method="close"]