Added FPS=5 limit when the game window is not active.

feature-rocketlauncher
unfa 2021-12-18 14:26:22 +01:00
parent 9c6dc9948a
commit 7f40d324a6
2 changed files with 10 additions and 0 deletions

View File

@ -39,4 +39,6 @@ func _process(delta):
text += "\nFPS: " + str(Engine.get_frames_per_second())
if Engine.target_fps != 0:
text += " (capped at " + str(Engine.target_fps) + ")"
text += "\n" + version + " · https://git.gieszer.link/unfa/liblast"

View File

@ -77,6 +77,14 @@ var game_score_limit = 10 #15
const destroy_free_player_crash_workaround = true
func _notification(what: int) -> void:
match what:
NOTIFICATION_APPLICATION_FOCUS_OUT:
Engine.target_fps = 5
NOTIFICATION_APPLICATION_FOCUS_IN:
# `0` means "unlimited".
Engine.target_fps = 0
func _process(delta):
uptime += delta