mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-05 23:40:07 +01:00
Add Limit FPS option to the 3D Graphics Settings demo (#970)
This commit is contained in:
@@ -230,6 +230,19 @@ popup/item_1/id = 1
|
||||
popup/item_2/text = "Enabled"
|
||||
popup/item_2/id = 2
|
||||
|
||||
[node name="LimitFPSLabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 16
|
||||
text = "Limit FPS:"
|
||||
|
||||
[node name="LimitFPSSlider" type="HSlider" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
max_value = 300.0
|
||||
step = 10.0
|
||||
|
||||
[node name="TAALabel" type="Label" parent="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
@@ -630,6 +643,7 @@ horizontal_alignment = 2
|
||||
[connection signal="value_changed" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/FSRSharpnessSlider" to="." method="_on_fsr_sharpness_slider_value_changed"]
|
||||
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/FullscreenOptionButton" to="." method="_on_fullscreen_option_button_item_selected"]
|
||||
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/VsyncOptionButton" to="." method="_on_vsync_option_button_item_selected"]
|
||||
[connection signal="value_changed" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/LimitFPSSlider" to="." method="_on_limit_fps_slider_value_changed"]
|
||||
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/TAAOptionButton" to="." method="_on_taa_option_button_item_selected"]
|
||||
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/MSAAOptionButton" to="." method="_on_msaa_option_button_item_selected"]
|
||||
[connection signal="item_selected" from="SettingsMenu/ScrollContainer/VBoxContainer/GridContainer2/FXAAOptionButton" to="." method="_on_fxaa_option_button_item_selected"]
|
||||
|
||||
@@ -11,10 +11,10 @@ config_version=5
|
||||
[application]
|
||||
|
||||
config/name="3D Graphics Settings"
|
||||
run/main_scene="res://control.tscn"
|
||||
config/features=PackedStringArray("4.0")
|
||||
config/icon="res://icon.webp"
|
||||
config/tags=PackedStringArray("3d", "demo", "official", "rendering", "settings")
|
||||
run/main_scene="res://control.tscn"
|
||||
config/features=PackedStringArray("4.1")
|
||||
config/icon="res://icon.webp"
|
||||
|
||||
[display]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
extends Control
|
||||
|
||||
|
||||
# Window project settings:
|
||||
# - Stretch mode is set to `canvas_items` (`2d` in Godot 3.x)
|
||||
# - Stretch aspect is set to `expand`
|
||||
@@ -114,6 +115,12 @@ func _on_vsync_option_button_item_selected(index: int) -> void:
|
||||
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED)
|
||||
|
||||
|
||||
func _on_limit_fps_slider_value_changed(value: float):
|
||||
# The maximum number of frames per second that can be rendered.
|
||||
# A value of 0 means "no limit".
|
||||
Engine.max_fps = value
|
||||
|
||||
|
||||
func _on_msaa_option_button_item_selected(index: int) -> void:
|
||||
# Multi-sample anti-aliasing. High quality, but slow. It also does not smooth out the edges of
|
||||
# transparent (alpha scissor) textures.
|
||||
|
||||
Reference in New Issue
Block a user