1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Improve Cpu Usage while in Idle (#394)

Use focus insted of mouse
This commit is contained in:
Laurenz Reinthaler 2020-12-15 16:30:47 +01:00 committed by GitHub
parent 35eeaf4e90
commit 329f4edc5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,8 +121,13 @@ func handle_backup() -> void:
func _notification(what : int) -> void: func _notification(what : int) -> void:
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: # Handle exit match what:
show_quit_dialog() MainLoop.NOTIFICATION_WM_QUIT_REQUEST: # Handle exit
show_quit_dialog()
MainLoop.NOTIFICATION_WM_FOCUS_OUT: # Called when the mouse isn't in the window anymore
Engine.set_target_fps(1) # then set the fps to 1 to relieve the cpu
MainLoop.NOTIFICATION_WM_MOUSE_ENTER: # Opposite of the above
Engine.set_target_fps(0) # 0 stands for maximum fps
func _on_files_dropped(_files : PoolStringArray, _screen : int) -> void: func _on_files_dropped(_files : PoolStringArray, _screen : int) -> void: