Add more options in the settings menu

soundtrack
Ensar Sarajčić 2021-11-18 20:05:35 +01:00
parent 3ac3ea268c
commit 00ae651966
3 changed files with 72 additions and 9 deletions

View File

@ -99,8 +99,10 @@ gear_down={
[physics]
common/enable_pause_aware_picking=true
3d/active_soft_world=false
[rendering]
quality/driver/fallback_to_gles2=true
quality/reflections/high_quality_ggx=false
environment/default_environment="res://default_env.tres"

View File

@ -10,6 +10,8 @@ onready var music_slider: HSlider = $MarginContainer/VSplitContainer/CenterConta
onready var auto_clutch_cb: CheckBox = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/AutoClutchCheckBox
onready var automatic_transmission_cb: CheckBox = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/AutomaticTransmissionCheckBox
onready var debug_cb: CheckBox = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/DebugModeCheckBox
onready var fullscreen_cb: CheckBox = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/FullscreenCheckBox
onready var borderless_cb: CheckBox = $MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BorderlessCheckBox
func _ready() -> void:
master_slider.value = db2linear(AudioServer.get_bus_volume_db(master_bus))
@ -18,6 +20,12 @@ func _ready() -> void:
debug_cb.pressed = GlobalSettings.debug
auto_clutch_cb.pressed = GlobalSettings.auto_clutch
automatic_transmission_cb.pressed = GlobalSettings.automatic_transmission
fullscreen_cb.pressed = false
borderless_cb.pressed = false
if OS.is_window_fullscreen():
_set_fullscreen(true)
if OS.get_borderless_window():
_set_borderless(true)
func _on_debug_toggled(new_state: bool) -> void:
@ -28,6 +36,16 @@ func _on_autoclutch_toggled(new_state: bool) -> void:
GlobalSettings.auto_clutch = new_state
func _on_fullscreen_toggled(new_state: bool) -> void:
_set_borderless(false)
_set_fullscreen(new_state)
func _on_borderless_toggled(new_state: bool) -> void:
_set_fullscreen(false)
_set_borderless(new_state)
func _on_automatictransmission_toggled(new_state: bool) -> void:
GlobalSettings.automatic_transmission = new_state
auto_clutch_cb.disabled = new_state == true
@ -47,3 +65,21 @@ func _on_SoundEffectsSlider_value_changed(new_value: float) -> void:
func _on_MusicSlider_value_changed(new_value: float) -> void:
AudioServer.set_bus_volume_db(music_bus, linear2db(new_value))
func _set_fullscreen(new_state: bool) -> void:
OS.set_window_fullscreen(new_state)
OS.set_window_maximized(new_state)
if new_state == true:
borderless_cb.disabled = true
else:
borderless_cb.disabled = false
func _set_borderless(new_state: bool) -> void:
OS.set_borderless_window(new_state)
OS.set_window_maximized(new_state)
if new_state == true:
fullscreen_cb.disabled = true
else:
fullscreen_cb.disabled = false

View File

@ -35,7 +35,7 @@ margin_bottom = -20.0
[node name="VSplitContainer" type="VSplitContainer" parent="MarginContainer"]
margin_right = 984.0
margin_bottom = 602.0
margin_bottom = 714.0
dragger_visibility = 1
[node name="HSplitContainer" type="HSplitContainer" parent="MarginContainer/VSplitContainer"]
@ -60,12 +60,12 @@ valign = 1
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VSplitContainer"]
margin_top = 96.0
margin_right = 984.0
margin_bottom = 602.0
margin_bottom = 714.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VSplitContainer/CenterContainer"]
margin_left = 311.0
margin_right = 672.0
margin_bottom = 506.0
margin_bottom = 618.0
[node name="Gameplay" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_right = 361.0
@ -181,25 +181,48 @@ custom_fonts/font = SubResource( 4 )
text = "Video"
align = 1
[node name="DebugLabel" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
[node name="FullscreenCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 415.0
margin_right = 361.0
margin_bottom = 442.0
margin_bottom = 463.0
custom_fonts/font = SubResource( 3 )
text = "Fullscreen"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="BorderlessCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 471.0
margin_right = 361.0
margin_bottom = 519.0
custom_fonts/font = SubResource( 3 )
text = "Borderless"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="DebugLabel" type="Label" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 527.0
margin_right = 361.0
margin_bottom = 554.0
custom_fonts/font = SubResource( 4 )
text = "Debug"
align = 1
[node name="DebugModeCheckBox" type="CheckBox" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 450.0
margin_top = 562.0
margin_right = 361.0
margin_bottom = 498.0
margin_bottom = 610.0
custom_fonts/font = SubResource( 3 )
text = "Debug mode (visible checkpoints)"
align = 1
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer"]
margin_top = 506.0
margin_top = 618.0
margin_right = 361.0
margin_bottom = 506.0
margin_bottom = 618.0
[connection signal="pressed" from="MarginContainer/VSplitContainer/HSplitContainer/BackButton" to="." method="_on_BackButton_pressed"]
[connection signal="toggled" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/AutoClutchCheckBox" to="." method="_on_autoclutch_toggled"]
@ -207,4 +230,6 @@ margin_bottom = 506.0
[connection signal="value_changed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/MasterSlider" to="." method="_on_MasterSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/SoundEffectsSlider" to="." method="_on_SoundEffectsSlider_value_changed"]
[connection signal="value_changed" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/MusicSlider" to="." method="_on_MusicSlider_value_changed"]
[connection signal="toggled" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/FullscreenCheckBox" to="." method="_on_fullscreen_toggled"]
[connection signal="toggled" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/BorderlessCheckBox" to="." method="_on_borderless_toggled"]
[connection signal="toggled" from="MarginContainer/VSplitContainer/CenterContainer/VBoxContainer/DebugModeCheckBox" to="." method="_on_debug_toggled"]