Skip to content

Commit

Permalink
fixed input always getting eaten correctly when returing True. fixed …
Browse files Browse the repository at this point in the history
…mouse not getting all the rebound keys as input.
  • Loading branch information
pokepetter committed May 30, 2024
1 parent 3bdf147 commit e8d6c84
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ursina/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ def input(self, key, is_raw=False): # internal method for handling input
for key in bound_keys:
__main__.input(key)

break_outer = False


for e in scene.entities:
if e.enabled is False or e.ignore or e.ignore_input:
continue
Expand All @@ -252,29 +255,33 @@ def input(self, key, is_raw=False): # internal method for handling input
if e.has_disabled_ancestor():
continue

if break_outer:
break

if hasattr(e, 'input') and callable(e.input):
break_outer = False
for key in bound_keys:
if break_outer:
break
if e.input(key): # if the input function returns True, eat the input
break_outer = True

break

if hasattr(e, 'scripts'):
break_outer = False
if break_outer:
break

for script in e.scripts:
if break_outer:
break

if script.enabled and hasattr(script, 'input') and callable(script.input):
for key in bound_keys:
if script.input(key): # if the input function returns True, eat the input
break_outer = True
break

mouse.input(key)
for key in bound_keys:
mouse.input(key)


def text_input(self, key): # internal method for handling text input
Expand Down

0 comments on commit e8d6c84

Please sign in to comment.