Settings now save between rounds
This commit is contained in:
parent
d977abbc26
commit
1426c43bd7
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=90 format=3 uid="uid://078w2ydk8xqb"]
|
[gd_scene load_steps=91 format=3 uid="uid://078w2ydk8xqb"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Scripts/UI/MainMenu.gd" id="1_apwjj"]
|
[ext_resource type="Script" path="res://Scripts/UI/MainMenu.gd" id="1_apwjj"]
|
||||||
[ext_resource type="Theme" uid="uid://kp44uy5twt4a" path="res://Theme/title.tres" id="2_3f6ag"]
|
[ext_resource type="Theme" uid="uid://kp44uy5twt4a" path="res://Theme/title.tres" id="2_3f6ag"]
|
||||||
@ -8,6 +8,7 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://c15w40e16g78s" path="res://Sprites/gift.png" id="6_dis66"]
|
[ext_resource type="Texture2D" uid="uid://c15w40e16g78s" path="res://Sprites/gift.png" id="6_dis66"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dsncoyuq0i02q" path="res://Models/kenney_city-kit-roads/Models/GLTF format/road_crossroad.glb" id="7_hlv1s"]
|
[ext_resource type="PackedScene" uid="uid://dsncoyuq0i02q" path="res://Models/kenney_city-kit-roads/Models/GLTF format/road_crossroad.glb" id="7_hlv1s"]
|
||||||
[ext_resource type="Script" path="res://Scripts/UI/CreditsMenu.gd" id="7_muosy"]
|
[ext_resource type="Script" path="res://Scripts/UI/CreditsMenu.gd" id="7_muosy"]
|
||||||
|
[ext_resource type="Script" path="res://Scripts/Settings.gd" id="7_npksp"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ckhtfnuf3aoi5" path="res://Models/kenney_city-kit-roads/Models/GLTF format/road_straight.glb" id="8_4tpst"]
|
[ext_resource type="PackedScene" uid="uid://ckhtfnuf3aoi5" path="res://Models/kenney_city-kit-roads/Models/GLTF format/road_straight.glb" id="8_4tpst"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dhem5ct3h665f" path="res://Sounds/Effects/Christmas Sound Effects #1 (by MrSnooze)/038 magic twinkle.wav" id="8_dgt8v"]
|
[ext_resource type="AudioStream" uid="uid://dhem5ct3h665f" path="res://Sounds/Effects/Christmas Sound Effects #1 (by MrSnooze)/038 magic twinkle.wav" id="8_dgt8v"]
|
||||||
[ext_resource type="Script" path="res://Scripts/Resources/Credit.gd" id="8_qsm6r"]
|
[ext_resource type="Script" path="res://Scripts/Resources/Credit.gd" id="8_qsm6r"]
|
||||||
@ -449,6 +450,7 @@ offset_right = 577.0
|
|||||||
offset_bottom = 293.0
|
offset_bottom = 293.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
script = ExtResource("7_npksp")
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="UI/Settings"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="UI/Settings"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
27
Scripts/Settings.gd
Normal file
27
Scripts/Settings.gd
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
class_name Settings extends MarginContainer
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
$VBoxContainer/TabContainer/Audio/VBoxContainer/Master/MasterSlider.value = db_to_linear(AudioServer.get_bus_volume_db(0))
|
||||||
|
$VBoxContainer/TabContainer/Audio/VBoxContainer/Music/MusicSlider.value = db_to_linear(AudioServer.get_bus_volume_db(1))
|
||||||
|
$VBoxContainer/TabContainer/Audio/VBoxContainer/Effects/EffectsSlider.value = db_to_linear(AudioServer.get_bus_volume_db(2))
|
||||||
|
$VBoxContainer/TabContainer/Audio/VBoxContainer/Ambiance/AmbianceSlider.value = db_to_linear(AudioServer.get_bus_volume_db(3))
|
||||||
|
|
||||||
|
$VBoxContainer/TabContainer/Video/VBoxContainer/MSAA/AntiAliasing.selected = get_window().msaa_3d as int
|
||||||
|
$VBoxContainer/TabContainer/Video/VBoxContainer/VSync/VSyncMode.selected = MainMenuUIHandler.vsyncSetting
|
||||||
|
|
||||||
|
match Engine.max_fps:
|
||||||
|
0:
|
||||||
|
$VBoxContainer/TabContainer/Video/VBoxContainer/FPSCap/FPSCap.selected = 0
|
||||||
|
30:
|
||||||
|
$VBoxContainer/TabContainer/Video/VBoxContainer/FPSCap/FPSCap.selected = 1
|
||||||
|
60:
|
||||||
|
$VBoxContainer/TabContainer/Video/VBoxContainer/FPSCap/FPSCap.selected = 2
|
||||||
|
90:
|
||||||
|
$VBoxContainer/TabContainer/Video/VBoxContainer/FPSCap/FPSCap.selected = 3
|
||||||
|
120:
|
||||||
|
$VBoxContainer/TabContainer/Video/VBoxContainer/FPSCap/FPSCap.selected = 4
|
||||||
|
144:
|
||||||
|
$VBoxContainer/TabContainer/Video/VBoxContainer/FPSCap/FPSCap.selected = 5
|
||||||
|
if (is_instance_valid(FPSCounter.instance)):
|
||||||
|
$VBoxContainer/TabContainer/Video/VBoxContainer/FPSCounter/CheckBox.button_pressed = FPSCounter.instance.visible
|
@ -1,5 +1,7 @@
|
|||||||
class_name MainMenuUIHandler extends Control
|
class_name MainMenuUIHandler extends Control
|
||||||
|
|
||||||
|
static var vsyncSetting: int = 1
|
||||||
|
|
||||||
@export var animator: AnimationPlayer
|
@export var animator: AnimationPlayer
|
||||||
|
|
||||||
func _on_settings_pressed() -> void:
|
func _on_settings_pressed() -> void:
|
||||||
@ -47,9 +49,10 @@ func _on_ambiance_slider_value_changed(value: float) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_anti_aliasing_item_selected(index: int) -> void:
|
func _on_anti_aliasing_item_selected(index: int) -> void:
|
||||||
RenderingServer.viewport_set_msaa_3d(get_window().get_viewport_rid(), index as RenderingServer.ViewportMSAA)
|
get_window().msaa_3d = index as Viewport.MSAA
|
||||||
|
|
||||||
func _on_v_sync_mode_item_selected(index: int) -> void:
|
func _on_v_sync_mode_item_selected(index: int) -> void:
|
||||||
|
vsyncSetting = index
|
||||||
DisplayServer.window_set_vsync_mode(index as DisplayServer.VSyncMode)
|
DisplayServer.window_set_vsync_mode(index as DisplayServer.VSyncMode)
|
||||||
|
|
||||||
func _on_fps_cap_item_selected(index: int) -> void:
|
func _on_fps_cap_item_selected(index: int) -> void:
|
||||||
|
@ -13,7 +13,6 @@ config_version=5
|
|||||||
config/name="Speedin' Santa"
|
config/name="Speedin' Santa"
|
||||||
run/main_scene="res://Scenes/UI/MainMenu.tscn"
|
run/main_scene="res://Scenes/UI/MainMenu.tscn"
|
||||||
config/features=PackedStringArray("4.3", "GL Compatibility")
|
config/features=PackedStringArray("4.3", "GL Compatibility")
|
||||||
run/max_fps=60
|
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user