From f3c481578e00ef8fb88d29218f990484926ca61c Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 25 Dec 2021 11:49:04 +0100 Subject: [PATCH] samples: Update `globalClock` references to `base.clock` --- samples/asteroids/main.py | 2 +- samples/ball-in-maze/main.py | 2 +- samples/culling/occluder_culling.py | 2 +- samples/culling/portal_culling.py | 2 +- samples/gamepad/flightstick.py | 2 +- samples/gamepad/gamepad.py | 2 +- samples/gamepad/steeringWheel.py | 2 +- samples/networking/06-simple-avatar/client.py | 2 +- samples/particles/advanced.py | 2 +- samples/roaming-ralph/main.py | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/samples/asteroids/main.py b/samples/asteroids/main.py index 4abe9be00f..fb57329fa4 100755 --- a/samples/asteroids/main.py +++ b/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 diff --git a/samples/ball-in-maze/main.py b/samples/ball-in-maze/main.py index 1ea47aeb05..8c4847e527 100755 --- a/samples/ball-in-maze/main.py +++ b/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 diff --git a/samples/culling/occluder_culling.py b/samples/culling/occluder_culling.py index 80d1687d43..0b492f553c 100755 --- a/samples/culling/occluder_culling.py +++ b/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) diff --git a/samples/culling/portal_culling.py b/samples/culling/portal_culling.py index 6f8d8aaf6f..49c2de86f6 100755 --- a/samples/culling/portal_culling.py +++ b/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) diff --git a/samples/gamepad/flightstick.py b/samples/gamepad/flightstick.py index 4520cfefb2..301c42ac94 100644 --- a/samples/gamepad/flightstick.py +++ b/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 diff --git a/samples/gamepad/gamepad.py b/samples/gamepad/gamepad.py index 8679a74187..5c67b2248c 100644 --- a/samples/gamepad/gamepad.py +++ b/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 diff --git a/samples/gamepad/steeringWheel.py b/samples/gamepad/steeringWheel.py index 09b0d9d167..81bd8285de 100644 --- a/samples/gamepad/steeringWheel.py +++ b/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: diff --git a/samples/networking/06-simple-avatar/client.py b/samples/networking/06-simple-avatar/client.py index c19cd6b2d4..a918d3b302 100644 --- a/samples/networking/06-simple-avatar/client.py +++ b/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. diff --git a/samples/particles/advanced.py b/samples/particles/advanced.py index 1521c1453d..be89a0d8d3 100755 --- a/samples/particles/advanced.py +++ b/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)) diff --git a/samples/roaming-ralph/main.py b/samples/roaming-ralph/main.py index a762cc72a5..62f65638c3 100755 --- a/samples/roaming-ralph/main.py +++ b/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.