aboutsummaryrefslogtreecommitdiff
path: root/client/game.py
diff options
context:
space:
mode:
authorTom Harley2017-12-02 18:03:27 +0000
committerTom Harley2017-12-02 18:03:27 +0000
commitd69874caf2ca6f14e0409f032a15594c60a54d68 (patch)
tree9de6e9a955820c93784c789dafa11210651cb9fe /client/game.py
parentMerge branch 'master' of https://github.com/magnostherobot/longpong (diff)
downloadlongpong-d69874caf2ca6f14e0409f032a15594c60a54d68.tar.gz
longpong-d69874caf2ca6f14e0409f032a15594c60a54d68.zip

almost working

Diffstat (limited to 'client/game.py')
-rw-r--r--client/game.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/client/game.py b/client/game.py
index 485a874..8a7a031 100644
--- a/client/game.py
+++ b/client/game.py
@@ -2,13 +2,6 @@ import time
import sdl2
import sdl2.ext
-class Rect:
- def __init__(self, x, y, width, height):
- self.x = x
- self.y = y
- self.width = width
- self.height = height
-
class Ball:
def __init__(self, pos, vel, size):
self.pos = pos
@@ -45,7 +38,7 @@ class Game:
def start(self):
self.place_windows()
# Tell the server how wide the screen is
- full_width = sum(self.renderer.get_screen_widths)
+ full_width = sum(self.renderer.get_screen_widths())
self.client.send_init(full_width)
# Wait for a start event
while not self.client.has_started():
@@ -84,8 +77,10 @@ class Game:
if self.events.has_quit() or self.client.has_stopped():
self.running = False
break
- self.update(None)
- self.renderer.render(None, None)
+ p_time = time
+ time = time.time()
+ self.update(time, p_time)
+ self.renderer.render(ball_list, paddle_list, (0, 0))
def update(self, time, p_time):
deltaT = time - p_time
@@ -128,7 +123,7 @@ class Game:
'x': ball.pos[0],
'y': ball.pos[1]
},
- 'time': time.time()
+ 'time': time
}
self.client.send_ballchange(msg)