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

Add setting for Godots low processor usage mode #1056

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions src/Autoload/Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,12 @@ var fps_limit := 0:
## Found in Preferences. Affects the per_pixel_transparency project setting.
## If [code]true[/code], it allows for the window to be transparent.
## This affects performance, so keep it [code]false[/code] if you don't need it.
var low_processor_usage := true:
set(value):
if value == low_processor_usage:
return
low_processor_usage = value
OS.low_processor_usage_mode = value
var window_transparency := false:
set(value):
if value == window_transparency:
Expand Down Expand Up @@ -680,6 +686,7 @@ func _init() -> void:
if ProjectSettings.get_setting("display/window/tablet_driver") == "winink":
tablet_driver = 1
single_window_mode = ProjectSettings.get_setting("display/window/subwindows/embed_subwindows")
low_processor_usage = ProjectSettings.get_setting("application/run/low_processor_mode")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this line is needed, as the low processor usage mode is being changed with OS.low_processor_usage_mode and not as a project setting.

window_transparency = ProjectSettings.get_setting(
"display/window/per_pixel_transparency/allowed"
)
Expand Down
6 changes: 6 additions & 0 deletions src/Preferences/PreferencesDialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ var preferences: Array[Preference] = [
"button_pressed",
true
),
Preference.new(
"low_processor_usage",
"Performance/PerformanceContainer/LowProcessorUsage",
"button_pressed",
true
),
Preference.new(
"window_transparency",
"Performance/PerformanceContainer/WindowTransparency",
Expand Down
13 changes: 13 additions & 0 deletions src/Preferences/PreferencesDialog.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,19 @@ mouse_default_cursor_shape = 2
button_pressed = true
text = "On"

[node name="LowProcessorUsageLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"]
layout_mode = 2
tooltip_text = "If this is toggled on, the application will slow down when not used. This helps lower CPU usage when idle."
mouse_filter = 0
text = "Lower processing speed when not in use"
Kiisu-Master marked this conversation as resolved.
Show resolved Hide resolved

[node name="LowProcessorUsage" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"]
layout_mode = 2
tooltip_text = "If this is toggled on, the application will slow down when not used. This helps lower CPU usage when idle."
mouse_default_cursor_shape = 2
button_pressed = true
text = "On"

[node name="WindowTransparencyLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"]
layout_mode = 2
tooltip_text = "If enabled, the application window can become transparent. This affects performance, so keep it off if you don't need it."
Expand Down
Loading