Browse Source

Enhanced exiting behaviour

feature/balanceutils
klonfish 8 years ago committed by klonfish
parent
commit
009a4973f1
  1. 13
      gamemenu.py

13
gamemenu.py

@ -325,7 +325,12 @@ if __name__ == '__main__':
inp1 = BalanceInput((host, int(port)), 0) inp1 = BalanceInput((host, int(port)), 0)
inp2 = BalanceInput((host, int(port)), 1) inp2 = BalanceInput((host, int(port)), 1)
while inp1.get_event() != InputEvent.STEP_ON: while True:
evt = inp1.get_event()
if evt == InputEvent.STEP_ON:
break
elif evt == InputEvent.QUIT:
sys.exit()
time.sleep(0.05) time.sleep(0.05)
init_frame = create_init_screen(dim) init_frame = create_init_screen(dim)
@ -363,10 +368,14 @@ if __name__ == '__main__':
wait_time = 3 wait_time = 3
start = time.time() start = time.time()
while time.time() < start+wait_time: while time.time() < start+wait_time:
if inp2.get_event() == InputEvent.STEP_ON: while True:
evt = inp2.get_event()
if evt == InputEvent.STEP_ON:
inp1.running = False inp1.running = False
inp2.running = False inp2.running = False
start_game(game, 2) start_game(game, 2)
elif evt == InputEvent.QUIT:
sys.exit()
time.sleep(0.1) time.sleep(0.1)
inp1.running = False inp1.running = False

Loading…
Cancel
Save