Vore_Sandbox_Remaster/scripts/settingsMenu.gd

29 lines
1.2 KiB
GDScript

extends Control
var conf: ConfigFile = Global.settingsfile
# Called when the node enters the scene tree for the first time.
func _ready():
#put load settings here. load using ConfigFile and its defaults feature
conf.load("user://settings")
$Scroll/VBox/touchcontrols.pressed = conf.get_value("Controls","show_touch",OS.has_touchscreen_ui_hint())
$Scroll/VBox/ws/wsize.value = int(conf.get_value("World","size",30))
$Scroll/VBox/fs/fsize.value = Global.theme.default_font.size
$Scroll/VBox/res/res.selected = Global.screensize
$Scroll/VBox/xray/mode.selected = Global.xray
func _on_SaR_pressed():
#save settings and go back to main menu
conf.set_value("Controls","show_touch",$Scroll/VBox/touchcontrols.pressed)
conf.set_value("World","size",$Scroll/VBox/ws/wsize.value)
conf.set_value("UI","font_size",$Scroll/VBox/fs/fsize.value)
conf.set_value("UI","screen_size",$Scroll/VBox/res/res.selected)
conf.set_value("UI","xray",$Scroll/VBox/xray/mode.selected)
Global.screensize = $Scroll/VBox/res/res.selected
Global.xray = $Scroll/VBox/xray/mode.selected
Global.set_scree_size()
Global.theme.default_font.size = $Scroll/VBox/fs/fsize.value
conf.save("user://settings")
get_tree().change_scene("res://mainmenu.tscn")