Selaa lähdekoodia

samples: Update `globalClock` references to `base.clock`

rdb 4 vuotta sitten
vanhempi
sitoutus
f3c481578e

+ 1 - 1
samples/asteroids/main.py

@@ -202,7 +202,7 @@ class AsteroidsDemo(ShowBase):
     def gameLoop(self, task):
         # Get the time elapsed since the next frame.  We need this for our
         # distance and velocity calculations.
-        dt = globalClock.getDt()
+        dt = self.clock.dt
 
         # If the ship is not alive, do nothing.  Tasks return Task.cont to
         # signify that the task should continue running. If Task.done were

+ 1 - 1
samples/ball-in-maze/main.py

@@ -266,7 +266,7 @@ class BallInMazeDemo(ShowBase):
     def rollTask(self, task):
         # Standard technique for finding the amount of time since the last
         # frame
-        dt = globalClock.getDt()
+        dt = base.clock.dt
 
         # If dt is large, then there has been a # hiccup that could cause the ball
         # to leave the field if this functions runs, so ignore the frame

+ 1 - 1
samples/culling/occluder_culling.py

@@ -123,7 +123,7 @@ class Game(ShowBase):
 
     def update(self, task):
         """Updates the camera based on the keyboard input."""
-        delta = globalClock.getDt()
+        delta = base.clock.dt
         move_x = delta * 3 * -self.keys['a'] + delta * 3 * self.keys['d']
         move_z = delta * 3 * self.keys['s'] + delta * 3 * -self.keys['w']
         self.camera.setPos(self.camera, move_x, -move_z, 0)

+ 1 - 1
samples/culling/portal_culling.py

@@ -135,7 +135,7 @@ class Game(ShowBase):
     def update(self, task):
         """Updates the camera based on the keyboard input. Once this is
         done, then the CellManager's update function is called."""
-        delta = globalClock.getDt()
+        delta = base.clock.dt
         move_x = delta * 3 * -self.keys['a'] + delta * 3 * self.keys['d']
         move_z = delta * 3 * self.keys['s'] + delta * 3 * -self.keys['w']
         self.camera.setPos(self.camera, move_x, -move_z, 0)

+ 1 - 1
samples/gamepad/flightstick.py

@@ -120,7 +120,7 @@ class App(ShowBase):
         self.lblAction.hide()
 
     def moveTask(self, task):
-        dt = globalClock.getDt()
+        dt = base.clock.dt
 
         if not self.flightStick:
             return task.cont

+ 1 - 1
samples/gamepad/gamepad.py

@@ -145,7 +145,7 @@ class App(ShowBase):
         self.lblAction.hide()
 
     def moveTask(self, task):
-        dt = globalClock.getDt()
+        dt = base.clock.dt
 
         if not self.gamepad:
             return task.cont

+ 1 - 1
samples/gamepad/steeringWheel.py

@@ -128,7 +128,7 @@ class App(ShowBase):
         self.wheelCenter = self.wheel.findAxis(InputDevice.Axis.wheel).value
 
     def moveTask(self, task):
-        dt = globalClock.getDt()
+        dt = base.clock.dt
         movementVec = Vec3()
 
         if not self.wheel:

+ 1 - 1
samples/networking/06-simple-avatar/client.py

@@ -45,7 +45,7 @@ class Avatar:
         # Get the time that elapsed since last frame.  We multiply this with
         # the desired speed in order to find out with which distance to move
         # in order to achieve that desired speed.
-        dt = globalClock.getDt()
+        dt = base.clock.dt
 
         # If the camera-left key is pressed, move camera left.
         # If the camera-right key is pressed, move camera right.

+ 1 - 1
samples/particles/advanced.py

@@ -207,7 +207,7 @@ class Particle:
             start_vel=self.__texStartVel,
             velocities=self.__texCurrVel,
             accel=(0, 0, self.__gravity),
-            start_time=globalClock.getFrameTime(),
+            start_time=base.clock.getFrameTime(),
             emission_times=self.__texTimes,
             part_duration=self.__partDuration,
             image=loader.loadTexture(self.__texture))

+ 1 - 1
samples/roaming-ralph/main.py

@@ -199,7 +199,7 @@ class RoamingRalphDemo(ShowBase):
         # Get the time that elapsed since last frame.  We multiply this with
         # the desired speed in order to find out with which distance to move
         # in order to achieve that desired speed.
-        dt = globalClock.getDt()
+        dt = base.clock.dt
 
         # If the camera-left key is pressed, move camera left.
         # If the camera-right key is pressed, move camera right.