add vsync option
This commit is contained in:
parent
645370fd4f
commit
cde61d144f
4 changed files with 53 additions and 12 deletions
|
|
@ -11,6 +11,7 @@ var shadows : int = 1
|
|||
var title_music : int = 1
|
||||
var title_dynamic : int = 1
|
||||
var mouse_sens : float = 1.0
|
||||
var vsync: int = 1
|
||||
|
||||
var theme_index = [
|
||||
"res://UI/Themes/Dark.tres",
|
||||
|
|
@ -42,6 +43,7 @@ func updateConfig():
|
|||
config.set_value("GRAPHICS", "msaa", msaa)
|
||||
config.set_value("GRAPHICS", "ssaa", ssaa)
|
||||
config.set_value("GRAPHICS", "shadows", shadows)
|
||||
config.set_value("GRAPHICS", "vsync", vsync)
|
||||
config.set_value("INTERFACE", "scaling", scaling)
|
||||
config.set_value("INTERFACE", "theme", theme)
|
||||
config.set_value("INTERFACE", "title_music", title_music)
|
||||
|
|
@ -56,15 +58,16 @@ func loadConfig():
|
|||
print("Couldn't load config!")
|
||||
return
|
||||
|
||||
FOV = config.get_value("GRAPHICS", "fov")
|
||||
msaa = config.get_value("GRAPHICS", "msaa")
|
||||
ssaa = config.get_value("GRAPHICS", "ssaa")
|
||||
shadows = config.get_value("GRAPHICS", "shadows")
|
||||
scaling = config.get_value("INTERFACE", "scaling")
|
||||
theme = config.get_value("INTERFACE", "theme")
|
||||
title_music = config.get_value("INTERFACE", "title_music")
|
||||
title_dynamic = config.get_value("INTERFACE", "title_dynamic")
|
||||
mouse_sens = config.get_value("INPUT", "mouse_sens")
|
||||
FOV = config.get_value("GRAPHICS", "fov", 80.0)
|
||||
msaa = config.get_value("GRAPHICS", "msaa", 1)
|
||||
ssaa = config.get_value("GRAPHICS", "ssaa", 1)
|
||||
shadows = config.get_value("GRAPHICS", "shadows", 1)
|
||||
vsync = config.get_value("GRAPHICS", "vsync", 1)
|
||||
scaling = config.get_value("INTERFACE", "scaling", 0)
|
||||
theme = config.get_value("INTERFACE", "theme", 0)
|
||||
title_music = config.get_value("INTERFACE", "title_music", 1)
|
||||
title_dynamic = config.get_value("INTERFACE", "title_dynamic", 1)
|
||||
mouse_sens = config.get_value("INPUT", "mouse_sens", 1.0)
|
||||
|
||||
print("config loaded.")
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ func _ready() -> void:
|
|||
$ShadowsOption.select(GlobalVariables.shadows)
|
||||
$FOVSlider.value = GlobalVariables.FOV
|
||||
$FOVSlider/CurrentLabel.text = str(int(GlobalVariables.FOV))
|
||||
$VSyncOption.select(GlobalVariables.vsync)
|
||||
|
||||
func _on_tab_bar_tab_changed(tab: int) -> void:
|
||||
if (thisTab == tab):
|
||||
|
|
@ -39,3 +40,9 @@ func _on_shadows_option_item_selected(index: int) -> void:
|
|||
GlobalVariables.shadows = index
|
||||
get_tree().set_group("lights", "shadow_enabled", index == 1)
|
||||
GlobalVariables.updateConfig()
|
||||
|
||||
|
||||
func _on_v_sync_option_item_selected(index: int) -> void:
|
||||
GlobalVariables.vsync = index
|
||||
DisplayServer.window_set_vsync_mode(index as DisplayServer.VSyncMode)
|
||||
GlobalVariables.updateConfig()
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@ func _ready():
|
|||
$Buttons/FreeRoamButton.grab_focus()
|
||||
|
||||
GlobalVariables.loadConfig()
|
||||
$SettingsScreen/DialogPanel/GraphicsPanel/FOVSlider.value = GlobalVariables.FOV
|
||||
$SettingsScreen/DialogPanel/GraphicsPanel/AAOption.selected = GlobalVariables.msaa
|
||||
$SettingsScreen/DialogPanel/GraphicsPanel/SSAAOption.selected = GlobalVariables.ssaa
|
||||
|
||||
get_window().set_theme(load(GlobalVariables.theme_index[GlobalVariables.theme]))
|
||||
if (GlobalVariables.title_music == 1): $Music.play()
|
||||
|
|
@ -19,6 +16,8 @@ func _ready():
|
|||
$BackgroundImage.visible = false
|
||||
$DynamicBackground.visible = true
|
||||
|
||||
DisplayServer.window_set_vsync_mode(GlobalVariables.vsync as DisplayServer.VSyncMode)
|
||||
|
||||
get_tree().set_group("lights", "shadow_enabled", GlobalVariables.shadows == 1)
|
||||
|
||||
var moddir = DirAccess.open("user://Mods")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue