final changes for better touch function
This commit is contained in:
6
main.py
6
main.py
@@ -491,6 +491,7 @@ def draw_game(hide_trailer=False):
|
||||
current_case.draw(screen)
|
||||
|
||||
async def show_instruction_screen(image):
|
||||
result = None
|
||||
if not image:
|
||||
return
|
||||
waiting = True
|
||||
@@ -499,10 +500,11 @@ async def show_instruction_screen(image):
|
||||
pygame.display.flip()
|
||||
await asyncio.sleep(0)
|
||||
for event in pygame.event.get():
|
||||
result = await touch(event)
|
||||
if event.type == pygame.QUIT:
|
||||
pygame.quit()
|
||||
sys.exit()
|
||||
elif await is_SPACE_event(event) or await touch(event) == "snap":
|
||||
elif await is_SPACE_event(event) or await result == "snap":
|
||||
waiting = False
|
||||
|
||||
async def fail_current_case():
|
||||
@@ -710,7 +712,7 @@ async def main():
|
||||
running = False
|
||||
elif event.type == pygame.KEYDOWN or event.type == pygame.JOYBUTTONDOWN or event.type == pygame.JOYHATMOTION or event.type == pygame.FINGERDOWN or touch_start or (event.type == pygame.MOUSEBUTTONDOWN and event.button == 1):
|
||||
if state == 1: # PLAYING
|
||||
result = None
|
||||
result = "none"
|
||||
if pygame.FINGERUP and touch_start:
|
||||
result = await touch(event)
|
||||
print(result)
|
||||
|
||||
Reference in New Issue
Block a user