diff --git a/engine b/engine index 65b25c8..026ead0 160000 --- a/engine +++ b/engine @@ -1 +1 @@ -Subproject commit 65b25c8be37aff5ab94c1c0b5a1410afa8a87f2b +Subproject commit 026ead0b33d1655a10f83d24ed2cb387b7ebcc43 diff --git a/game/game.py b/game/game.py index f2833d2..bdad261 100644 --- a/game/game.py +++ b/game/game.py @@ -48,7 +48,9 @@ def main(): print("Done: ", round(gen_end - gen_begin, 2), "seconds") print("Initializing...") - window = initialize(b'RK Island', 1600, 900) + display = create_display(b'RK Island', 1600, 900) + events = create_events(display) + render_initialize() terrain_shader = shader.load('terrain', 'common') tests_shader = shader.load('tests', 'common') sky_shader = shader.load('sky') @@ -163,7 +165,7 @@ def main(): draw_max = 0.0 draw_avg = 0.0 perf_count = 0 - events = buffer(Event, 16) + events_buffer = buffer(Event, 16) try: for frame in range(10000): current_time = time.monotonic() - start_time @@ -226,6 +228,7 @@ def main(): frame_end = time.thread_time() end_frame() + swap_buffers(display) if frame > 0: draw_ms = draw_end - draw_begin @@ -240,10 +243,10 @@ def main(): stop = False while True: - nevents = consume_events(events, len(events)) + nevents = consume_events(events, events_buffer, len(events_buffer)) if not nevents: break - for event in events[:nevents]: + for event in events_buffer[:nevents]: if event.type == EVENT_FOCUS_IN: print("EVENT_FOCUS_IN") elif event.type == EVENT_FOCUS_OUT: @@ -294,4 +297,6 @@ def main(): destroy_shader(terrain_shader) destroy_shader(tests_shader) destroy_shader(sky_shader) - terminate() + render_terminate() + destroy_events(display, events) + destroy_display(display)