From 2876b70cf0e5fff63b313e8252e0a3f2ff326f39 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Sat, 2 Jan 2021 00:40:01 +1030 Subject: [PATCH] Add wakelock button for later gamepad testing. Currently nonfunctional on desktop platforms due to engine limitation. --- main.tscn | 11 +++++++++++ scripts/InputHandler.gd | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/main.tscn b/main.tscn index 9725b76..a55bee7 100644 --- a/main.tscn +++ b/main.tscn @@ -245,3 +245,14 @@ text = "Vsync" __meta__ = { "_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 +} diff --git a/scripts/InputHandler.gd b/scripts/InputHandler.gd index 5d087ac..d155e4b 100644 --- a/scripts/InputHandler.gd +++ b/scripts/InputHandler.gd @@ -36,12 +36,16 @@ func _ready(): # connect("button_pressed", self, "print_pressed") $"/root".connect("size_changed", self, "resize") $VsyncButton.connect("toggled", self, "update_vsync") + $WakelockButton.connect("toggled", self, "update_wakelock") $FilterSlider.connect("value_changed", self, "update_filter") resize() func update_vsync(setting: bool): 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): GameTheme.screen_filter_min_alpha = alpha