Add escape key for quitting.
This commit is contained in:
parent
8c07acc22f
commit
dc9ff0582f
@ -5,6 +5,13 @@ class InputManager:
|
|||||||
QUIT = 0
|
QUIT = 0
|
||||||
|
|
||||||
def process_input(self):
|
def process_input(self):
|
||||||
|
last_input = None
|
||||||
|
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
return InputManager.QUIT
|
last_input = InputManager.QUIT
|
||||||
|
elif event.type == pygame.KEYDOWN:
|
||||||
|
if event.key == pygame.K_ESCAPE:
|
||||||
|
last_input = InputManager.QUIT
|
||||||
|
|
||||||
|
return last_input
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user