Mercurial > sypikslang
comparison gamelib/main.py @ 44:d35a3762edda
Idiomatic
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Mon, 07 May 2012 16:53:18 +0200 |
parents | 2bdac178ec6f |
children | a2980cc9a060 |
comparison
equal
deleted
inserted
replaced
43:2bdac178ec6f | 44:d35a3762edda |
---|---|
90 global GAME_IS_RUNNING | 90 global GAME_IS_RUNNING |
91 for event in pygame.event.get(): | 91 for event in pygame.event.get(): |
92 if MOUSE_DOWN: | 92 if MOUSE_DOWN: |
93 if event.type == MOUSEBUTTONUP: | 93 if event.type == MOUSEBUTTONUP: |
94 MOUSE_DOWN = False | 94 MOUSE_DOWN = False |
95 WINDOW_STACK[len(WINDOW_STACK) - 1].on_mouse_up(event.pos) | 95 WINDOW_STACK[-1].on_mouse_up(event.pos) |
96 elif event.type == MOUSEMOTION: | 96 elif event.type == MOUSEMOTION: |
97 WINDOW_STACK[len(WINDOW_STACK) - 1].on_mouse_move(event.pos) | 97 WINDOW_STACK[-1].on_mouse_move(event.pos) |
98 elif not MOUSE_DOWN and event.type == MOUSEBUTTONDOWN: | 98 elif not MOUSE_DOWN and event.type == MOUSEBUTTONDOWN: |
99 MOUSE_DOWN = True | 99 MOUSE_DOWN = True |
100 WINDOW_STACK[len(WINDOW_STACK) - 1].on_mouse_down(event.pos) | 100 WINDOW_STACK[-1].on_mouse_down(event.pos) |
101 elif event.type == QUIT: | 101 elif event.type == QUIT: |
102 GAME_IS_RUNNING = False | 102 GAME_IS_RUNNING = False |