slow down cpu usage when window minimized

This commit is contained in:
David Rose 2003-01-23 18:01:14 +00:00
parent 8db75fced0
commit d06a170b07

View File

@ -782,6 +782,17 @@ class ShowBase(DirectObject.DirectObject):
# Finally, render the frame.
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
# C++, not in Python.
throwNewFrame()