Quit when pressing 'q'
parent
bb02cafc6b
commit
0e88ce887d
|
@ -5,7 +5,7 @@ pygame.init()
|
|||
|
||||
infos = pygame.display.Info()
|
||||
# size = infos.current_w, infos.current_h
|
||||
size = 1024, 768
|
||||
size = 1280, 768
|
||||
background = 255, 255, 255
|
||||
|
||||
screen = pygame.display.set_mode(size)
|
||||
|
@ -31,16 +31,16 @@ i = 0
|
|||
pressed = False
|
||||
while True:
|
||||
for event in pygame.event.get():
|
||||
if event.type in (pygame.QUIT, pygame.KEYDOWN):
|
||||
if event.type == pygame.QUIT or event.type == pygame.KEYDOWN and event.unicode == 'q':
|
||||
sys.exit()
|
||||
elif event.type == pygame.MOUSEBUTTONDOWN:
|
||||
if button_up_rect.collidepoint(pygame.mouse.get_pos()):
|
||||
if button_up_rect.collidepoint(event.pos):
|
||||
pressed = True
|
||||
elif event.type == pygame.MOUSEBUTTONUP:
|
||||
if button_up_rect.collidepoint(pygame.mouse.get_pos()):
|
||||
if button_up_rect.collidepoint(event.pos):
|
||||
pressed = False
|
||||
i += 1
|
||||
if button2.collidepoint(pygame.mouse.get_pos()):
|
||||
if button2.collidepoint(event.pos):
|
||||
i -= 1
|
||||
|
||||
screen.fill(background)
|
||||
|
|
Loading…
Reference in New Issue