Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(QAM): add FPS limit slider #242

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/ui/vapor_ui/qam/performance_menu.gd
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
extends Control

var gamescope := load("res://core/global/gamescope.tres") as Gamescope
var logger := Log.get_logger("PerformanceMenu", Log.LEVEL.INFO)

@onready var mangoapp_slider := $%MangoAppSlider
@onready var fps_slider := $%FramerateLimitSlider
@onready var fps_timer := $%FramerateChangeTimer as Timer


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
mangoapp_slider.value_changed.connect(_on_mangoapp_changed)
fps_slider.value_changed.connect(_on_fps_limit_changed)
fps_timer.timeout.connect(_on_fps_limit_timer_timeout)


# Set the mangoapp config on slider change
Expand All @@ -27,3 +32,14 @@ func _on_mangoapp_changed(value: float) -> void:
if value >= 4:
MangoApp.set_config(MangoApp.CONFIG_INSANE)
return


# Whenever the FPS slider is changed, start a small timer to limit the number
# of changes
func _on_fps_limit_changed(_value: float) -> void:
fps_timer.start()


# Update the gamescope FPS limit
func _on_fps_limit_timer_timeout() -> void:
gamescope.set_fps_limit(fps_slider.value)
10 changes: 9 additions & 1 deletion core/ui/vapor_ui/qam/performance_menu.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,17 @@ text = "Per-game Profile"
separator_visible = false

[node name="FramerateLimitSlider" parent="VBoxContainer" instance=ExtResource("1_yptsc")]
visible = false
unique_name_in_owner = true
layout_mode = 2
text = "FPS Limit"
value = 60.0
max_value = 240.0
step = 10.0

[node name="FramerateChangeTimer" type="Timer" parent="VBoxContainer/FramerateLimitSlider"]
unique_name_in_owner = true
wait_time = 0.5
one_shot = true

[node name="RefreshRateSlider" parent="VBoxContainer" instance=ExtResource("1_yptsc")]
visible = false
Expand Down