final changes for better touch function
This commit is contained in:
7
main.py
7
main.py
@@ -491,7 +491,6 @@ def draw_game(hide_trailer=False):
|
|||||||
current_case.draw(screen)
|
current_case.draw(screen)
|
||||||
|
|
||||||
async def show_instruction_screen(image):
|
async def show_instruction_screen(image):
|
||||||
result = None
|
|
||||||
if not image:
|
if not image:
|
||||||
return
|
return
|
||||||
waiting = True
|
waiting = True
|
||||||
@@ -504,7 +503,7 @@ async def show_instruction_screen(image):
|
|||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
elif await is_SPACE_event(event) or await result == "snap":
|
elif await is_SPACE_event(event) or result == "snap":
|
||||||
waiting = False
|
waiting = False
|
||||||
|
|
||||||
async def fail_current_case():
|
async def fail_current_case():
|
||||||
@@ -713,9 +712,11 @@ async def main():
|
|||||||
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):
|
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
|
if state == 1: # PLAYING
|
||||||
result = "none"
|
result = "none"
|
||||||
if pygame.FINGERUP and touch_start:
|
if event.type == pygame.FINGERUP and touch_start:
|
||||||
result = await touch(event)
|
result = await touch(event)
|
||||||
print(result)
|
print(result)
|
||||||
|
elif event.type == pygame.FINGERDOWN and not touch_start:
|
||||||
|
await touch(event)
|
||||||
|
|
||||||
if await is_LEFT_event(event) or result == "ontop":
|
if await is_LEFT_event(event) or result == "ontop":
|
||||||
can_tip = current_case.length_units * UNIT_HEIGHT <= TRAILER_HEIGHT
|
can_tip = current_case.length_units * UNIT_HEIGHT <= TRAILER_HEIGHT
|
||||||
|
|||||||
Reference in New Issue
Block a user