diff options
| author | Billy Brown | 2017-12-02 18:06:08 +0000 |
|---|---|---|
| committer | Billy Brown | 2017-12-02 18:06:08 +0000 |
| commit | 7f2ca2c3ab881a1652cccc4268e8843f2f383260 (patch) | |
| tree | 8877425f73fea40fc6704873c6eb6ebfff7f5bba /client | |
| parent | almost working (diff) | |
| download | longpong-7f2ca2c3ab881a1652cccc4268e8843f2f383260.tar.gz longpong-7f2ca2c3ab881a1652cccc4268e8843f2f383260.zip | |
Can quit the game at any time
Diffstat (limited to 'client')
| -rw-r--r-- | client/game.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/client/game.py b/client/game.py index 8a7a031..b8c4af2 100644 --- a/client/game.py +++ b/client/game.py @@ -1,6 +1,7 @@ import time import sdl2 import sdl2.ext +import sys class Ball: def __init__(self, pos, vel, size): @@ -54,6 +55,8 @@ class Game: break # Tell the server to start if the spacebar is pressed self.events.poll() + if self.events.has_quit(): + sys.exit(0) if self.events.has_space(): self.client.send_start() # Run the game loop @@ -62,6 +65,8 @@ class Game: def place_windows(self): while True: self.events.poll() + if self.events.has_quit(): + sys.exit(0) if self.events.has_num(): for numkey in self.events.get_nums(): self.renderer.maximise_window(numkey) |
