Example #1
0
def playAndWait(self, buffer = None):
    if buffer != None:
        self.play(buffer)
    else:
        self.play()
    self.wait()
    mthread.sleep()
Example #2
0
 def sleep(self, sec = -1.0):
     """
     Utility function. Sleeps for 'sec' seconds. If 'sec' is not provided
     it sleeps forever.
     
     The method returns the second thats it actualy slept.
     """
     time = CEngine.getWorldTime()
     mthread.sleep(sec)
     return CEngine.getWorldTime() - time
Example #3
0
 def sleep(self, sec=-1.0):
     """
     Utility function. Sleeps for 'sec' seconds. If 'sec' is not provided
     it sleeps forever.
     
     The method returns the second thats it actualy slept.
     """
     time = CEngine.getWorldTime()
     mthread.sleep(sec)
     return CEngine.getWorldTime() - time
Example #4
0
def bench():
    mthread.sleep(0.1)  # Sleep a little time to let things settle

    timer = sylphis.CTimer()  # Generate a timer to count time
    startFrame = (
        CEngine.getFrameCount()
    )  # Log the number of frames rendered by the engine at the start of the benchmark

    mthread.sleep(50.0)  # Sleep for 50.0 seconds of game world time

    time = timer.getTime()  # Read the real world time it took to render all the frames
    frames = float(CEngine.getFrameCount() - startFrame)  # Calculate the number of frames the engine rendered
    print "Average FPS : %4.2f" % (frames / time)

    shutdown()  # Shutdown the engine
Example #5
0
def bench():
    mthread.sleep(0.1)  # Sleep a little time to let things settle

    timer = sylphis.CTimer()  # Generate a timer to count time
    startFrame = CEngine.getFrameCount(
    )  # Log the number of frames rendered by the engine at the start of the benchmark

    mthread.sleep(50.0)  # Sleep for 50.0 seconds of game world time

    time = timer.getTime(
    )  # Read the real world time it took to render all the frames
    frames = float(
        CEngine.getFrameCount() -
        startFrame)  # Calculate the number of frames the engine rendered
    print "Average FPS : %4.2f" % (frames / time)

    shutdown()  # Shutdown the engine
Example #6
0
 def updateHudTime(self):
     while self.timeLeft > 0.0:
         self.timeLeft -= mthread.sleep(1.0)
         mins = self.timeLeft // 60.0
         secs = self.timeLeft % 60.0
         self.hud.time = (mins, secs)
Example #7
0
def daynight():
	t = 0.0
	mthread.sleep(15.0)
	while t < 10.0:
		setLightDir((t * 0.08) % 2.0)
		t += mthread.sleep(0.0001)
Example #8
0
 def updateHudTime(self):
     while self.timeLeft > 0.0:
         self.timeLeft -= mthread.sleep(1.0)
         mins = self.timeLeft // 60.0
         secs = self.timeLeft % 60.0
         self.hud.time = (mins, secs)
Example #9
0
def waitAction(self):
    self._waitAction()
    mthread.sleep()