Add wakelock button for later gamepad testing.

Currently nonfunctional on desktop platforms due to engine limitation.
This commit is contained in:
Luke Hubmayer-Werner 2021-01-02 00:40:01 +10:30
parent 25dcc5e2fa
commit 2876b70cf0
2 changed files with 15 additions and 0 deletions

View File

@ -245,3 +245,14 @@ text = "Vsync"
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="WakelockButton" type="CheckButton" parent="InputHandler"]
margin_left = 4.0
margin_top = 240.0
margin_right = 121.0
margin_bottom = 130.0
pressed = true
text = "Wakelock"
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -36,12 +36,16 @@ func _ready():
# connect("button_pressed", self, "print_pressed") # connect("button_pressed", self, "print_pressed")
$"/root".connect("size_changed", self, "resize") $"/root".connect("size_changed", self, "resize")
$VsyncButton.connect("toggled", self, "update_vsync") $VsyncButton.connect("toggled", self, "update_vsync")
$WakelockButton.connect("toggled", self, "update_wakelock")
$FilterSlider.connect("value_changed", self, "update_filter") $FilterSlider.connect("value_changed", self, "update_filter")
resize() resize()
func update_vsync(setting: bool): func update_vsync(setting: bool):
OS.vsync_enabled = setting OS.vsync_enabled = setting
func update_wakelock(setting: bool):
OS.keep_screen_on = setting # This is waiting on godotengine/godot#35536 to be merged to do anything in Linux :(
func update_filter(alpha: float): func update_filter(alpha: float):
GameTheme.screen_filter_min_alpha = alpha GameTheme.screen_filter_min_alpha = alpha