diff --git a/assets/text/text.csv b/assets/text/text.csv index 0ce8eb1..0216b04 100644 --- a/assets/text/text.csv +++ b/assets/text/text.csv @@ -27,6 +27,55 @@ SETTINGS_ACCELERATION_Y,"Acceleration, Vertical" SETTINGS_INVERT_PITCH,"Invert Pitch" SETTINGS_GRAPHICS,Graphics SETTINGS_GRAPHICS_HEADING,"Graphics & Display" +SETTINGS_GRAPHICS_DISPLAY_HEADING,Display +SETTINGS_GRAPHICS_FULLSCREEN,Fullscreen +SETTINGS_GRAPHICS_VSYNC,V-Sync +SETTINGS_GRAPHICS_AA_HEADING,Antialiasing +SETTINGS_GRAPHICS_MSAA,MSAA +SETTINGS_GRAPHICS_MSAA_0,"Disabled (Fastest)" +SETTINGS_GRAPHICS_MSAA_2,"2× (Average)" +SETTINGS_GRAPHICS_MSAA_4,"4× (Slow)" +SETTINGS_GRAPHICS_MSAA_8,"8× (Slowest)" +SETTINGS_GRAPHICS_FXAA,"Enable FXAA" +SETTINGS_GRAPHICS_TAA,"Enable TAA" +SETTINGS_GRAPHICS_DEBANDING,"Use Debanding" +SETTINGS_GRAPHICS_TEXTURES_HEADING,Textures +SETTINGS_GRAPHICS_ANISOTROPIC,"Anisotropic Filtering Level (requires restart)" +SETTINGS_GRAPHICS_ANISOTROPIC_0,"Disabled (Fastest)" +SETTINGS_GRAPHICS_ANISOTROPIC_1,"2× (Faster)" +SETTINGS_GRAPHICS_ANISOTROPIC_2,"4× (Fast)" +SETTINGS_GRAPHICS_ANISOTROPIC_3,"8× (Average)" +SETTINGS_GRAPHICS_ANISOTROPIC_4,"16× (Slow)" +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, +, SETTINGS_AUDIO,Audio SETTINGS_AUDIO_HEADING,"Audio Settings" SETTINGS_CONTROLS,Controls diff --git a/src/game/game.tscn b/src/game/game.tscn index 50c56f6..5425d05 100644 --- a/src/game/game.tscn +++ b/src/game/game.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=9 format=3 uid="uid://cefit4bc8akbb"] +[gd_scene load_steps=10 format=3 uid="uid://cefit4bc8akbb"] [ext_resource type="Script" path="res://src/game/game.gd" id="1_4qa87"] [ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="2_y3adf"] [ext_resource type="Script" path="res://src/ui/decorations/rumbler.gd" id="3_3vfdb"] [ext_resource type="Script" path="res://src/ui/game_viewport_container.gd" id="3_rmm5i"] +[ext_resource type="Script" path="res://src/game/game_viewport.gd" id="5_v2qv5"] [sub_resource type="Animation" id="Animation_c3dlb"] length = 0.001 @@ -192,6 +193,7 @@ use_taa = true audio_listener_enable_3d = true size = Vector2i(1920, 1080) render_target_update_mode = 4 +script = ExtResource("5_v2qv5") [node name="Content" type="Node" parent="RootControl/Rumbler/ViewportContainer/Viewport"] unique_name_in_owner = true diff --git a/src/game/game_viewport.gd b/src/game/game_viewport.gd new file mode 100644 index 0000000..9b4763e --- /dev/null +++ b/src/game/game_viewport.gd @@ -0,0 +1,16 @@ +extends SubViewport +## Logic for dynamically resetting viewport graphics settings + + +func _ready() -> void: + ProjectSettings.settings_changed.connect(apply_rendering_settings) + + +func apply_rendering_settings() -> void: + print_debug("Applying rendering settings to viewport") + + msaa_2d = ProjectSettings.get_setting("rendering/anti_aliasing/quality/msaa_2d") + msaa_3d = ProjectSettings.get_setting("rendering/anti_aliasing/quality/msaa_3d") + screen_space_aa = ProjectSettings.get_setting("rendering/anti_aliasing/quality/screen_space_aa") + use_taa = ProjectSettings.get_setting("rendering/anti_aliasing/quality/use_taa") + use_debanding = ProjectSettings.get_setting("rendering/anti_aliasing/quality/use_debanding") diff --git a/src/ui/menus/settings_menu/settings/checkbox_setting/fullscreen_setting.gd b/src/ui/menus/settings_menu/settings/checkbox_setting/fullscreen_setting.gd new file mode 100644 index 0000000..e9c762c --- /dev/null +++ b/src/ui/menus/settings_menu/settings/checkbox_setting/fullscreen_setting.gd @@ -0,0 +1,10 @@ +extends "res://src/ui/menus/settings_menu/settings/checkbox_setting/checkbox_setting.gd" +## Special case setting for fullscreen mode + + +func initialize_value(value: Variant) -> void: + checkbox.button_pressed = (value as Window.Mode) == Window.MODE_FULLSCREEN + + +func get_value() -> Variant: + return Window.MODE_FULLSCREEN if checkbox.button_pressed else Window.MODE_WINDOWED diff --git a/src/ui/menus/settings_menu/settings/dropdown_setting/dropdown_setting.gd b/src/ui/menus/settings_menu/settings/dropdown_setting/dropdown_setting.gd new file mode 100644 index 0000000..3a54b6f --- /dev/null +++ b/src/ui/menus/settings_menu/settings/dropdown_setting/dropdown_setting.gd @@ -0,0 +1,12 @@ +extends Setting +## Setting with a dropdown menu representing an enum value + +@onready var dropdown: OptionButton = %Dropdown + + +func initialize_value(value: Variant) -> void: + dropdown.selected = dropdown.get_item_index(value as int) + + +func get_value() -> Variant: + return dropdown.get_item_id(dropdown.selected) diff --git a/src/ui/menus/settings_menu/settings/dropdown_setting/dropdown_setting.tscn b/src/ui/menus/settings_menu/settings/dropdown_setting/dropdown_setting.tscn index 61efceb..81700ed 100644 --- a/src/ui/menus/settings_menu/settings/dropdown_setting/dropdown_setting.tscn +++ b/src/ui/menus/settings_menu/settings/dropdown_setting/dropdown_setting.tscn @@ -1,9 +1,13 @@ -[gd_scene load_steps=2 format=3 uid="uid://dpry41u0ctikn"] +[gd_scene load_steps=3 format=3 uid="uid://dpry41u0ctikn"] [ext_resource type="PackedScene" uid="uid://dcah6r3ku60g6" path="res://src/ui/menus/settings_menu/settings/setting/setting.tscn" id="1_km84n"] +[ext_resource type="Script" path="res://src/ui/menus/settings_menu/settings/dropdown_setting/dropdown_setting.gd" id="2_ubo13"] [node name="DropdownSetting" instance=ExtResource("1_km84n")] +script = ExtResource("2_ubo13") -[node name="OptionButton" type="OptionButton" parent="PanelContainer/MarginContainer" index="0"] +[node name="Dropdown" type="OptionButton" parent="PanelContainer/MarginContainer" index="0"] +unique_name_in_owner = true layout_mode = 2 +selected = 0 item_count = 1 diff --git a/src/ui/menus/settings_menu/settings_menu.tscn b/src/ui/menus/settings_menu/settings_menu.tscn index 9ade6e1..63e8225 100644 --- a/src/ui/menus/settings_menu/settings_menu.tscn +++ b/src/ui/menus/settings_menu/settings_menu.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=4 format=3 uid="uid://d3eaqw2rdurct"] +[gd_scene load_steps=6 format=3 uid="uid://d3eaqw2rdurct"] [ext_resource type="Script" path="res://src/ui/menus/settings_menu/settings_menu.gd" id="1_lbcn7"] [ext_resource type="PackedScene" uid="uid://bpmpj4n6xp17l" path="res://src/ui/menus/settings_menu/settings/checkbox_setting/checkbox_setting.tscn" id="2_f274v"] [ext_resource type="PackedScene" uid="uid://dut1lj8ju37sq" path="res://src/ui/menus/settings_menu/settings/numeric_setting/numeric_setting.tscn" id="3_jox8e"] +[ext_resource type="PackedScene" uid="uid://dpry41u0ctikn" path="res://src/ui/menus/settings_menu/settings/dropdown_setting/dropdown_setting.tscn" id="4_g7eck"] +[ext_resource type="Script" path="res://src/ui/menus/settings_menu/settings/checkbox_setting/fullscreen_setting.gd" id="4_ug1id"] [node name="SettingsMenu" type="MarginContainer"] anchors_preset = 15 @@ -14,9 +16,10 @@ script = ExtResource("1_lbcn7") [node name="TabContainer" type="TabContainer" parent="."] layout_mode = 2 -current_tab = 0 +current_tab = 1 [node name="SETTINGS_GAME" type="MarginContainer" parent="TabContainer"] +visible = false layout_mode = 2 theme_type_variation = &"SettingsPageContainer" metadata/_tab_index = 0 @@ -157,7 +160,6 @@ key = &"game/config/controls/camera/invert_pitch" text = "SETTINGS_INVERT_PITCH" [node name="SETTINGS_GRAPHICS" type="MarginContainer" parent="TabContainer"] -visible = false layout_mode = 2 theme_type_variation = &"SettingsPageContainer" metadata/_tab_index = 1 @@ -194,6 +196,114 @@ theme_type_variation = &"SettingsListMargin" [node name="SettingsList" type="VBoxContainer" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer"] layout_mode = 2 +[node name="DisplayHeading" type="HBoxContainer" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList"] +layout_mode = 2 + +[node name="Label" type="Label" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/DisplayHeading"] +layout_mode = 2 +theme_type_variation = &"HeaderMedium" +text = "SETTINGS_GRAPHICS_DISPLAY_HEADING" + +[node name="HSeparator" type="HSeparator" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/DisplayHeading"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Fullscreen" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("2_f274v")] +layout_mode = 2 +script = ExtResource("4_ug1id") +key = &"display/window/size/mode" + +[node name="SettingLabel" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/Fullscreen" index="1"] +text = "SETTINGS_GRAPHICS_FULLSCREEN" + +[node name="VSync" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("2_f274v")] +layout_mode = 2 +key = &"display/window/vsync/vsync_mode" + +[node name="SettingLabel" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/VSync" index="1"] +text = "SETTINGS_GRAPHICS_VSYNC" + +[node name="AntialiasingHeading" type="HBoxContainer" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList"] +layout_mode = 2 + +[node name="Label" type="Label" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/AntialiasingHeading"] +layout_mode = 2 +theme_type_variation = &"HeaderMedium" +text = "SETTINGS_GRAPHICS_AA_HEADING" + +[node name="HSeparator" type="HSeparator" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/AntialiasingHeading"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="MSAA" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("4_g7eck")] +layout_mode = 2 +key = &"rendering/anti_aliasing/quality/msaa_3d" + +[node name="SettingLabel" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/MSAA" index="1"] +text = "SETTINGS_GRAPHICS_MSAA" + +[node name="Dropdown" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/MSAA/PanelContainer/MarginContainer" index="0"] +item_count = 4 +popup/item_0/text = "SETTINGS_GRAPHICS_MSAA_0" +popup/item_1/text = "SETTINGS_GRAPHICS_MSAA_2" +popup/item_1/id = 1 +popup/item_2/text = "SETTINGS_GRAPHICS_MSAA_4" +popup/item_2/id = 2 +popup/item_3/text = "SETTINGS_GRAPHICS_MSAA_8" +popup/item_3/id = 3 + +[node name="FXAA" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("2_f274v")] +layout_mode = 2 +key = &"rendering/anti_aliasing/quality/screen_space_aa" + +[node name="SettingLabel" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/FXAA" index="1"] +text = "SETTINGS_GRAPHICS_FXAA" + +[node name="TAA" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("2_f274v")] +layout_mode = 2 +key = &"rendering/anti_aliasing/quality/use_taa" + +[node name="SettingLabel" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TAA" index="1"] +text = "SETTINGS_GRAPHICS_TAA" + +[node name="Debanding" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("2_f274v")] +layout_mode = 2 +key = &"rendering/anti_aliasing/quality/use_debanding" + +[node name="SettingLabel" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/Debanding" index="1"] +text = "SETTINGS_GRAPHICS_DEBANDING" + +[node name="TextureHeading" type="HBoxContainer" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList"] +layout_mode = 2 + +[node name="Label" type="Label" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TextureHeading"] +layout_mode = 2 +theme_type_variation = &"HeaderMedium" +text = "SETTINGS_GRAPHICS_TEXTURES_HEADING" + +[node name="HSeparator" type="HSeparator" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TextureHeading"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="AnisotropicLevel" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList" groups=["Settings"] instance=ExtResource("4_g7eck")] +layout_mode = 2 +key = &"rendering/textures/default_filters/anisotropic_filtering_level" + +[node name="SettingLabel" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/AnisotropicLevel" index="1"] +text = "SETTINGS_GRAPHICS_ANISOTROPIC" + +[node name="Dropdown" parent="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/AnisotropicLevel/PanelContainer/MarginContainer" index="0"] +item_count = 5 +popup/item_0/text = "SETTINGS_GRAPHICS_ANISOTROPIC_0" +popup/item_1/text = "SETTINGS_GRAPHICS_ANISOTROPIC_1" +popup/item_1/id = 1 +popup/item_2/text = "SETTINGS_GRAPHICS_ANISOTROPIC_2" +popup/item_2/id = 2 +popup/item_3/text = "SETTINGS_GRAPHICS_ANISOTROPIC_3" +popup/item_3/id = 3 +popup/item_4/text = "SETTINGS_GRAPHICS_ANISOTROPIC_4" +popup/item_4/id = 4 + [node name="SETTINGS_AUDIO" type="MarginContainer" parent="TabContainer"] visible = false layout_mode = 2 @@ -306,3 +416,10 @@ text = "UI_ACCEPT" [editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/AccelerationX"] [editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/AccelerationY"] [editable path="TabContainer/SETTINGS_GAME/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/InvertPitch"] +[editable path="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/Fullscreen"] +[editable path="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/VSync"] +[editable path="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/MSAA"] +[editable path="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/FXAA"] +[editable path="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/TAA"] +[editable path="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/Debanding"] +[editable path="TabContainer/SETTINGS_GRAPHICS/VBoxContainer/ScrollContainer/MarginContainer/SettingsList/AnisotropicLevel"]