From 869e7b4ad47d5a603e0e9409e341779d1ffcdfd7 Mon Sep 17 00:00:00 2001 From: osquallo Date: Mon, 30 Jul 2018 12:32:44 +0200 Subject: [PATCH] petit fix en cas d'abscence de la taille de police dans le fichier conf. --- scenes/GUI/GUI.gd | 10 +++++----- scenes/GUI/GUI.tscn | 2 +- scenes/GUI/Settings/Settings.gd | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/scenes/GUI/GUI.gd b/scenes/GUI/GUI.gd index 6de5702..220b5d9 100644 --- a/scenes/GUI/GUI.gd +++ b/scenes/GUI/GUI.gd @@ -41,11 +41,11 @@ func _input(event): play() # ---------------------------------- # Capturing/Freeing the cursor -# if Input.is_action_just_pressed("ui_free_cursor"): -# if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE: -# Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) -# else: -# Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + if Input.is_action_just_pressed("ui_free_cursor") and event is InputEventKey: + if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE: + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + else: + Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) # ---------------------------------- # Si on est en mode "deplacement", on desative le focus sur l'interface diff --git a/scenes/GUI/GUI.tscn b/scenes/GUI/GUI.tscn index a4c6885..ef7b0b3 100644 --- a/scenes/GUI/GUI.tscn +++ b/scenes/GUI/GUI.tscn @@ -19,7 +19,7 @@ _sections_unfolded = [ "Font", "Settings" ] default_font = SubResource( 1 ) -[node name="GUI" type="MarginContainer"] +[node name="GUI" type="MarginContainer" index="0"] anchor_left = 0.0 anchor_top = 0.0 diff --git a/scenes/GUI/Settings/Settings.gd b/scenes/GUI/Settings/Settings.gd index 9974fa2..03fdb3e 100644 --- a/scenes/GUI/Settings/Settings.gd +++ b/scenes/GUI/Settings/Settings.gd @@ -23,7 +23,8 @@ func load_settings(): if err: print("Error code when loading config file: ", err) - $Menus.get_theme().default_font.size = config_file.get_value( "theme", "font_size" ) + if $Menus.get_theme() and config_file.get_value( "theme", "font_size" ): + $Menus.get_theme().default_font.size = config_file.get_value( "theme", "font_size" ) $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size_bar.value = config_file.get_value( "theme", "font_size" ) $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size/font_size_value.text = str( $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size_bar.value )