mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
*** empty log message ***
This commit is contained in:
parent
20987630f3
commit
b8d81e561e
@ -21,10 +21,6 @@ def getTimeFrame():
|
||||
|
||||
# Ask for the time last frame
|
||||
t = globalClock.getTime()
|
||||
|
||||
# Set the clock to have last frame's time in case we were
|
||||
# Paused at the prompt for a long time
|
||||
globalClock.setTime(t)
|
||||
|
||||
# Get the new frame count
|
||||
f = globalClock.getFrameCount()
|
||||
@ -259,16 +255,24 @@ class TaskManager:
|
||||
return len(self.taskList)
|
||||
|
||||
def run(self):
|
||||
|
||||
# Set the clock to have last frame's time in case we were
|
||||
# Paused at the prompt for a long time
|
||||
t = globalClock.getTime()
|
||||
globalClock.setTime(t)
|
||||
|
||||
self.running = 1
|
||||
while self.running:
|
||||
try:
|
||||
startTime = time.time()
|
||||
startTime = globalClock.getRealTime()
|
||||
self.step()
|
||||
finishTime = time.time()
|
||||
finishTime = globalClock.getRealTime()
|
||||
# Max out the frame rate so we do not starve the cpu
|
||||
if (maxFps > 0):
|
||||
dt = finishTime - startTime
|
||||
time.sleep(max(0, (1.0/maxFps)-dt))
|
||||
length = (1.0/maxFps)-dt
|
||||
if (length > 0):
|
||||
time.sleep(length)
|
||||
except KeyboardInterrupt:
|
||||
self.stop()
|
||||
except:
|
||||
|
Loading…
x
Reference in New Issue
Block a user