Terminate on key release.
This commit is contained in:
parent
34277274a3
commit
7ed23a5d5f
14
game/game.py
14
game/game.py
@ -154,6 +154,7 @@ def main():
|
||||
clouds_orientation = tests_batch.params[clouds_id].orientation
|
||||
|
||||
print("Running...")
|
||||
events = buffer(Event, 16)
|
||||
start_time = time.monotonic()
|
||||
current_time = 0.0
|
||||
frame_min = 10000.0
|
||||
@ -236,6 +237,19 @@ def main():
|
||||
frame_max = max(frame_max, frame_ms)
|
||||
frame_avg += frame_ms
|
||||
perf_count += 1
|
||||
|
||||
stop = False
|
||||
while True:
|
||||
nevents = consume_events(events, len(events))
|
||||
if not nevents:
|
||||
break
|
||||
for event in events[:nevents]:
|
||||
if event.type == EVENT_KEY_RELEASE:
|
||||
print("EVENT_KEY_RELEASE:", event.data.key.keycode)
|
||||
stop = True
|
||||
if stop:
|
||||
break
|
||||
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user