Added boilerplate code for graphics menu items

map_02
Jan Heemstra 2021-12-01 00:03:18 +01:00
parent 8e55695f51
commit ee998abc9d
3 changed files with 266 additions and 14 deletions

View File

@ -43,12 +43,36 @@ func load_settings():
func apply_settings():
for key in settings.keys():
match key:
"Fullscreen":
toggle_fullscreen(settings[key])
"Sensitivity":
set_mouse_sensitivity(settings[key])
"EyeCandyLighting":
toggle_lighting(settings[key])
"GraphicsEyeCandyLighting":
set_lighting(settings[key])
"GraphicsFullscreen":
set_fullscreen(settings[key])
"GraphicsAmbientOcclusion":
set_ambient_occlusion(settings[key])
"GraphicsShadows":
set_shadows(settings[key])
"GraphicsGlobalIllumination":
set_global_illumination(settings[key])
"GraphicsScreenSpaceReflections":
set_screen_space_reflections(settings[key])
"GraphicsReflectionProbes":
set_reflection_probes(settings[key])
"GraphicsGlow":
set_glow(settings[key])
"GraphicsMSAA":
set_MSAA(settings[key])
"GraphicsFXAA":
set_FXAA(settings[key])
"GraphicsDebanding":
set_debanding(settings[key])
"GraphicsDecalsStatic":
set_decals_static(settings[key])
"GraphicsDecalsDecals":
set_decals_decals(settings[key])
"GraphicsDynamicLights":
set_dynamic_lights(settings[key])
# These functions are for applying settings changes
func quit_game():
@ -66,19 +90,66 @@ func quit_game():
get_tree().quit()
func toggle_fullscreen(is_fullscreen):
func set_mouse_sensitivity(sensitivity):
pass
func set_fullscreen(is_fullscreen):
if is_fullscreen:
get_tree().get_root().mode = Window.MODE_FULLSCREEN
else:
get_tree().get_root().mode = Window.MODE_WINDOWED
func toggle_lighting(is_enabled):
func set_lighting(is_enabled):
var map = get_tree().get_root().get_node("Main").get_node("Map")
map.get_node("Lights").visible = is_enabled
map.get_node("Decals").visible = is_enabled
map.get_node("ReflectionProbes").visible = is_enabled
func set_mouse_sensitivity(sensitivity):
func set_ambient_occlusion(is_enabled):
# TODO
pass
func set_shadows(is_enabled):
# TODO
pass
func set_global_illumination(is_enabled):
# TODO
pass
func set_screen_space_reflections(is_enabled):
# TODO
pass
func set_reflection_probes(is_enabled):
# TODO
pass
func set_glow(is_enabled):
# TODO
pass
func set_MSAA(is_enabled):
# TODO
pass
func set_FXAA(is_enabled):
# TODO
pass
func set_debanding(is_enabled):
# TODO
pass
func set_decals_static(is_enabled):
# TODO
pass
func set_decals_decals(is_enabled):
# TODO
pass
func set_dynamic_lights(is_enabled):
# TODO
pass

View File

@ -2,10 +2,70 @@ extends "res://Assets/UI/Menu.gd"
func on_fullscreen_toggled(button_pressed):
if GUI:
GUI.toggle_fullscreen(button_pressed)
GUI.set_fullscreen(button_pressed)
$Fullscreen.save_data()
func on_lighting_toggled(button_pressed):
if GUI:
GUI.toggle_lighting(button_pressed)
GUI.set_lighting(button_pressed)
$Lighting.save_data()
func on_ambient_occlusion_toggled(button_pressed):
if GUI:
GUI.set_ambient_occlusion(button_pressed)
$AmbientOcclusion.save_data()
func on_shadows_toggled(button_pressed):
if GUI:
GUI.set_shadows(button_pressed)
$Shadows.save_data()
func on_global_illumination_toggled(button_pressed):
if GUI:
GUI.set_global_illumination(button_pressed)
$GlobalIllumination.save_data()
func on_screen_space_reflections_toggled(button_pressed):
if GUI:
GUI.set_screen_space_reflections(button_pressed)
$ScreenSpaceReflections.save_data()
func on_reflection_probes_toggled(button_pressed):
if GUI:
GUI.set_reflection_probes(button_pressed)
$ReflectionProbes.save_data()
func on_glow_toggled(button_pressed):
if GUI:
GUI.set_glow(button_pressed)
$Glow.save_data()
func on_MSAA_toggled(button_pressed):
if GUI:
GUI.set_MSAA(button_pressed)
$MSAA.save_data()
func on_FXAA_toggled(button_pressed):
if GUI:
GUI.set_FXAA(button_pressed)
$FXAA.save_data()
func on_debanding_toggled(button_pressed):
if GUI:
GUI.set_debanding(button_pressed)
$Debanding.save_data()
func on_decals_static_toggled(button_pressed):
if GUI:
GUI.set_decals_static(button_pressed)
$DecalsStatic.save_data()
func on_decals_decals_toggled(button_pressed):
if GUI:
GUI.set_decals_decals(button_pressed)
$DecalsDecals.save_data()
func on_dynamic_lights_toggled(button_pressed):
if GUI:
GUI.set_dynamic_lights(button_pressed)
$DynamicLights.save_data()

View File

@ -12,8 +12,9 @@ anchor_right = 0.0
anchor_bottom = 0.0
offset_right = 250.0
offset_bottom = 40.0
theme_override_font_sizes/font_size = 16
label = "Fullscreen"
index = "Fullscreen"
index = "GraphicsFullscreen"
[node name="Lighting" parent="." index="1" instance=ExtResource( "3" )]
anchor_right = 0.0
@ -22,11 +23,131 @@ offset_top = 44.0
offset_right = 250.0
offset_bottom = 84.0
label = "Eye Candy Lighting"
index = "EyeCandyLighting"
index = "GraphicsEyeCandyLighting"
[node name="Back" parent="." index="2"]
[node name="AmbientOcclusion" parent="." index="2" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 88.0
offset_bottom = 117.0
offset_right = 250.0
offset_bottom = 128.0
label = "Ambient Occlusion"
index = "GraphicsAmbientOcclusion"
[node name="Shadows" parent="." index="3" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 132.0
offset_right = 250.0
offset_bottom = 172.0
label = "Shadows"
index = "GraphicsShadows"
[node name="GlobalIllumination" parent="." index="4" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 176.0
offset_right = 250.0
offset_bottom = 216.0
label = "Global Illumination"
index = "GraphicsGlobalIllumination"
[node name="ScreenSpaceReflections" parent="." index="5" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 220.0
offset_right = 250.0
offset_bottom = 260.0
label = "Screen Space Reflections"
index = "GraphicsScreenSpaceReflections"
[node name="ReflectionProbes" parent="." index="6" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 264.0
offset_right = 250.0
offset_bottom = 304.0
label = "Reflection Probes"
index = "GraphicsReflectionProbes"
[node name="Glow" parent="." index="7" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 308.0
offset_right = 250.0
offset_bottom = 348.0
label = "Glow"
index = "GraphicsGlow"
[node name="MSAA" parent="." index="8" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 352.0
offset_right = 250.0
offset_bottom = 392.0
label = "MSAA"
index = "GraphicsMSAA"
[node name="FXAA" parent="." index="9" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 396.0
offset_right = 250.0
offset_bottom = 436.0
label = "FXAA"
index = "GraphicsFXAA"
[node name="Debanding" parent="." index="10" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 440.0
offset_right = 250.0
offset_bottom = 480.0
label = "Debanding"
index = "GraphicsDebanding"
[node name="DecalsStatic" parent="." index="11" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 484.0
offset_right = 250.0
offset_bottom = 524.0
label = "Decals Static"
index = "GraphicsDecalsStatic"
[node name="DecalsDecals" parent="." index="12" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 528.0
offset_right = 250.0
offset_bottom = 568.0
label = "Decals Decals"
index = "GraphicsDecalsDecals"
[node name="DynamicLights" parent="." index="13" instance=ExtResource( "3" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_top = 572.0
offset_right = 250.0
offset_bottom = 612.0
label = "Dynamic Lights"
index = "GraphicsDynamicLights"
[node name="Back" parent="." index="14"]
offset_top = 616.0
offset_bottom = 645.0
[connection signal="toggled" from="Fullscreen" to="." method="on_fullscreen_toggled"]
[connection signal="toggled" from="Lighting" to="." method="on_lighting_toggled"]
[connection signal="toggled" from="AmbientOcclusion" to="." method="on_ambient_occlusion_toggled"]
[connection signal="toggled" from="Shadows" to="." method="on_shadows_toggled"]
[connection signal="toggled" from="GlobalIllumination" to="." method="on_global_illumination_toggled"]
[connection signal="toggled" from="ScreenSpaceReflections" to="." method="on_screen_space_reflections_toggled"]
[connection signal="toggled" from="ReflectionProbes" to="." method="on_reflection_probes_toggled"]
[connection signal="toggled" from="Glow" to="." method="on_glow_toggled"]
[connection signal="toggled" from="MSAA" to="." method="on_MSAA_toggled"]
[connection signal="toggled" from="FXAA" to="." method="on_FXAA_toggled"]
[connection signal="toggled" from="Debanding" to="." method="on_debanding_toggled"]
[connection signal="toggled" from="DecalsStatic" to="." method="on_decals_static_toggled"]
[connection signal="toggled" from="DecalsDecals" to="." method="on_decals_decals_toggled"]
[connection signal="toggled" from="DynamicLights" to="." method="on_dynamic_lights_toggled"]