diff --git a/scenes/GUI/GUI.tscn b/scenes/GUI/GUI.tscn index 82a9af4..8dc1729 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" index="0"] +[node name="GUI" type="MarginContainer"] anchor_left = 0.0 anchor_top = 0.0 diff --git a/scenes/GUI/HUD/HUD.tscn b/scenes/GUI/HUD/HUD.tscn index f732dd5..c7ddd17 100644 --- a/scenes/GUI/HUD/HUD.tscn +++ b/scenes/GUI/HUD/HUD.tscn @@ -12,7 +12,7 @@ [ext_resource path="res://scenes/GUI/HUD/trauma.gd" type="Script" id=10] [ext_resource path="res://scenes/GUI/HUD/douleur.gd" type="Script" id=11] -[node name="HUD" type="MarginContainer" index="0"] +[node name="HUD" type="MarginContainer"] anchor_left = 0.0 anchor_top = 0.0 diff --git a/scenes/GUI/HUD/WindowControl.gd b/scenes/GUI/HUD/WindowControl.gd index da3ab84..8d186a5 100644 --- a/scenes/GUI/HUD/WindowControl.gd +++ b/scenes/GUI/HUD/WindowControl.gd @@ -117,12 +117,6 @@ func load_from_file( config_file ): func save_to_file( config_file ): - print( "saving "+ self.name +" in file"+ str(config_file) ) - print( "... position: "+ str(self.rect_position) ) - print( "... size: "+ str(self.rect_size) ) - print( "......" ) - print( "" ) - config_file.set_value(self.name, "position", self.rect_position) config_file.set_value(self.name, "size", current_rect_size) if $VBoxContainer/Content.visible: diff --git a/scenes/GUI/Settings/Settings.gd b/scenes/GUI/Settings/Settings.gd index 09f95c6..9974fa2 100644 --- a/scenes/GUI/Settings/Settings.gd +++ b/scenes/GUI/Settings/Settings.gd @@ -9,14 +9,37 @@ func _ready(): $Menus/TabContainer/Display/ScrollContainer/VBoxContainer/Resizable/CheckBox.pressed = ProjectSettings.get_setting( "display/window/size/resizable" ) $Menus/TabContainer/Display/ScrollContainer/VBoxContainer/CurrentScreen/SpinBox.value = OS.current_screen - $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size/font_size_value.text = str( $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size_bar.value ) + load_settings() + func _on_font_size_bar_value_changed(value): $Menus/TabContainer/Test/ScrollContainer/VBoxContainer/font_size/font_size_value.text = str( value ) $Menus.get_theme().default_font.size = value emit_signal( "font_changed", value ) +func load_settings(): + var config_file = ConfigFile.new() + var err = config_file.load( "user://settings.cfg" ) + if err: + print("Error code when loading config file: ", err) + + $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 ) + + + func _on_ReturnButton_pressed(): + + var config_file = ConfigFile.new() + var err = config_file.load( "user://settings.cfg" ) + if err: + print("Error code when loading config file: ", err) + + config_file.set_value("theme", "font_size", $Menus.get_theme().default_font.size) + + config_file.save( "user://settings.cfg" ) + emit_signal( "return_pressed" ) diff --git a/scenes/GUI/Settings/Settings.tscn b/scenes/GUI/Settings/Settings.tscn index e1d7182..a995a38 100644 --- a/scenes/GUI/Settings/Settings.tscn +++ b/scenes/GUI/Settings/Settings.tscn @@ -148,7 +148,7 @@ use_filter = false font_data = ExtResource( 2 ) _sections_unfolded = [ "Font", "Settings" ] -[node name="Settings" type="MarginContainer"] +[node name="Settings" type="MarginContainer" index="0"] anchor_left = 0.0 anchor_top = 0.0 @@ -1609,7 +1609,6 @@ margin_bottom = 446.0 [node name="Footer" type="HBoxContainer" parent="Menus" index="2"] -editor/display_folded = true anchor_left = 0.0 anchor_top = 0.0 anchor_right = 0.0