generated from krampus/template-godot4
Settings overrides are written to a file under user://
This commit is contained in:
parent
dff8065f95
commit
f75af2196d
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
# Godot-specific ignores
|
# Godot-specific ignores
|
||||||
.import/
|
.import/
|
||||||
override.cfg
|
|
||||||
export.cfg
|
export.cfg
|
||||||
export_presets.cfg
|
export_presets.cfg
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ config_version=5
|
||||||
config/name="GFOLF 2"
|
config/name="GFOLF 2"
|
||||||
config/description="GFOLF: Combat Golf Action"
|
config/description="GFOLF: Combat Golf Action"
|
||||||
run/main_scene="res://src/game/game.tscn"
|
run/main_scene="res://src/game/game.tscn"
|
||||||
|
config/project_settings_override="user://settings.godot"
|
||||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||||
run/max_fps=60
|
run/max_fps=60
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
class_name GameSettingsType extends Node
|
class_name GameSettingsType extends Node
|
||||||
## Container for project settings, for quick runtime access.
|
## Container for project settings, for quick runtime access.
|
||||||
|
|
||||||
|
var settings_file: String
|
||||||
|
|
||||||
var free_camera_speed: float
|
var free_camera_speed: float
|
||||||
var x_sensitivity: float
|
var x_sensitivity: float
|
||||||
var y_sensitivity: float
|
var y_sensitivity: float
|
||||||
|
@ -16,6 +18,8 @@ func _init() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _read_settings() -> void:
|
func _read_settings() -> void:
|
||||||
|
settings_file = ProjectSettings.get_setting("application/config/project_settings_override")
|
||||||
|
|
||||||
free_camera_speed = ProjectSettings.get_setting("game/config/controls/camera/free_camera_speed")
|
free_camera_speed = ProjectSettings.get_setting("game/config/controls/camera/free_camera_speed")
|
||||||
x_sensitivity = ProjectSettings.get_setting("game/config/controls/camera/x_axis_sensitivity")
|
x_sensitivity = ProjectSettings.get_setting("game/config/controls/camera/x_axis_sensitivity")
|
||||||
y_sensitivity = ProjectSettings.get_setting("game/config/controls/camera/y_axis_sensitivity")
|
y_sensitivity = ProjectSettings.get_setting("game/config/controls/camera/y_axis_sensitivity")
|
||||||
|
|
|
@ -2,7 +2,6 @@ extends MarginContainer
|
||||||
## Menu allowing the user to adjust game configuration.
|
## Menu allowing the user to adjust game configuration.
|
||||||
|
|
||||||
const SETTINGS_GROUP := "Settings"
|
const SETTINGS_GROUP := "Settings"
|
||||||
const SETTINGS_FILE := "override.cfg"
|
|
||||||
|
|
||||||
@onready var control_binding_list: VBoxContainer = %ControlBindingList
|
@onready var control_binding_list: VBoxContainer = %ControlBindingList
|
||||||
|
|
||||||
|
@ -36,7 +35,8 @@ func apply() -> void:
|
||||||
|
|
||||||
## Write all applied settings to disk.
|
## Write all applied settings to disk.
|
||||||
func save_settings() -> void:
|
func save_settings() -> void:
|
||||||
ProjectSettings.save_custom(SETTINGS_FILE)
|
print_debug("Writing settings to ", Game.settings.settings_file)
|
||||||
|
ProjectSettings.save_custom(Game.settings.settings_file)
|
||||||
BindingLoader.write()
|
BindingLoader.write()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue