mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
slow down cpu usage when window minimized
This commit is contained in:
parent
8db75fced0
commit
d06a170b07
@ -782,6 +782,17 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
# Finally, render the frame.
|
# Finally, render the frame.
|
||||||
self.graphicsEngine.renderFrame()
|
self.graphicsEngine.renderFrame()
|
||||||
|
|
||||||
|
if self.mainWinMinimized:
|
||||||
|
# If the main window is minimized, slow down the app a bit
|
||||||
|
# by sleeping here in igloop so we don't use all available
|
||||||
|
# CPU needlessly.
|
||||||
|
|
||||||
|
# Note: this isn't quite right if multiple windows are
|
||||||
|
# open. We should base this on whether *all* windows are
|
||||||
|
# minimized, not just the main window. But it will do for
|
||||||
|
# now until someone complains.
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
# Lerp stuff needs this event, and it must be generated in
|
# Lerp stuff needs this event, and it must be generated in
|
||||||
# C++, not in Python.
|
# C++, not in Python.
|
||||||
throwNewFrame()
|
throwNewFrame()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user