From 119cd76156ef773527d0aa8d975c08912899ab30 Mon Sep 17 00:00:00 2001 From: Roz K Date: Sat, 24 Dec 2022 06:41:02 +0100 Subject: [PATCH] Bump engine submodule and quit with a click or by pressing q. --- engine | 2 +- game/game.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/engine b/engine index 61cfdbc..65b25c8 160000 --- a/engine +++ b/engine @@ -1 +1 @@ -Subproject commit 61cfdbccf3230b73d42eb90f6eec934dbe1ddfdb +Subproject commit 65b25c8be37aff5ab94c1c0b5a1410afa8a87f2b diff --git a/game/game.py b/game/game.py index 73f62a0..f2833d2 100644 --- a/game/game.py +++ b/game/game.py @@ -153,8 +153,7 @@ def main(): cube_orientation = tests_batch.params[cube_id].orientation clouds_orientation = tests_batch.params[clouds_id].orientation - print("Running...") - events = buffer(Event, 16) + print("Running... Click or press q to quit") start_time = time.monotonic() current_time = 0.0 frame_min = 10000.0 @@ -164,6 +163,7 @@ def main(): draw_max = 0.0 draw_avg = 0.0 perf_count = 0 + events = buffer(Event, 16) try: for frame in range(10000): current_time = time.monotonic() - start_time @@ -244,8 +244,13 @@ def main(): if not nevents: break for event in events[:nevents]: - if event.type == EVENT_KEY_RELEASE: - print("EVENT_KEY_RELEASE:", event.data.key.keycode) + if event.type == EVENT_FOCUS_IN: + print("EVENT_FOCUS_IN") + elif event.type == EVENT_FOCUS_OUT: + print("EVENT_FOCUS_OUT") + elif event.type == EVENT_KEY_PRESS and event.data.key.character == 'q': + stop = True + elif event.type == EVENT_BUTTON_RELEASE: stop = True if stop: break