From 0df1c5f7799fdd63c3cd3fdc92bc9ccc60d1da8f Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Tue, 25 Aug 2015 19:49:46 +0200 Subject: clean quit --- gui.py | 6 ++++-- main.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gui.py b/gui.py index 57b08c5..895b1ac 100644 --- a/gui.py +++ b/gui.py @@ -8,6 +8,8 @@ import math import time from agarnet.agarnet.vec import Vec +running = True + font_fallback = False try: from pygame import freetype @@ -272,7 +274,7 @@ def draw_markers(): draw_marker(marker[i], colors[i], marker_updated[i]) def draw_frame(): - global screen, movement, zoom, screensize, input, bot_input, marker, marker_updated + global screen, movement, zoom, screensize, input, bot_input, marker, marker_updated, running pygame.event.pump() clock.tick() @@ -328,7 +330,7 @@ def draw_frame(): input = False bot_input = True if event.key == K_ESCAPE: - pygame.quit() + running = False if event.key == K_r: c.send_respawn() if event.type == MOUSEBUTTONDOWN: diff --git a/main.py b/main.py index 08793d3..0cd9b30 100644 --- a/main.py +++ b/main.py @@ -58,7 +58,7 @@ strategy = Strategy(c) autorespawn_counter = 60 # main loop -while True: +while gui.running: c.on_message() gui.draw_frame() @@ -79,3 +79,5 @@ while True: autorespawn_counter = 60 else: autorespawn_counter-=1 + +print("bye") -- cgit v1.2.3