mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
*** empty log message ***
This commit is contained in:
parent
f1c005149f
commit
f97a47558b
@ -24,6 +24,9 @@ class ShowBase:
|
|||||||
self.wantSound = self.config.GetBool('want-sound', 1)
|
self.wantSound = self.config.GetBool('want-sound', 1)
|
||||||
self.wantDIRECT = self.config.GetBool('want-directtools', 0)
|
self.wantDIRECT = self.config.GetBool('want-directtools', 0)
|
||||||
|
|
||||||
|
# Set a maximum frame rate on the render loop (0 means do not limit)
|
||||||
|
Task.maxFps = self.config.GetInt('max-fps', 120)
|
||||||
|
|
||||||
import Loader
|
import Loader
|
||||||
|
|
||||||
self.initialState = NodeAttributes()
|
self.initialState = NodeAttributes()
|
||||||
|
@ -2,12 +2,16 @@
|
|||||||
from libpandaexpressModules import *
|
from libpandaexpressModules import *
|
||||||
from DirectNotify import *
|
from DirectNotify import *
|
||||||
from PythonUtil import *
|
from PythonUtil import *
|
||||||
|
import time
|
||||||
|
|
||||||
exit = -1
|
exit = -1
|
||||||
done = 0
|
done = 0
|
||||||
cont = 1
|
cont = 1
|
||||||
|
|
||||||
|
# Note: this is dconfig'ed in ShowBase.py, but Tasks want to be independent
|
||||||
|
# of ShowBase and panda, so we have to set an initial value here
|
||||||
|
maxFps = 120
|
||||||
|
|
||||||
# Store the global clock
|
# Store the global clock
|
||||||
globalClock = ClockObject.getGlobalClock()
|
globalClock = ClockObject.getGlobalClock()
|
||||||
|
|
||||||
@ -258,7 +262,13 @@ class TaskManager:
|
|||||||
self.running = 1
|
self.running = 1
|
||||||
while self.running:
|
while self.running:
|
||||||
try:
|
try:
|
||||||
|
startTime = time.time()
|
||||||
self.step()
|
self.step()
|
||||||
|
finishTime = time.time()
|
||||||
|
# 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))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
self.stop()
|
self.stop()
|
||||||
except:
|
except:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user