axes cancelled

This commit is contained in:
Frank DeMarco 2017-07-14 14:15:02 -04:00
parent 316d354f07
commit 25df1d29bd
1 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,7 @@ class Input(GameChild):
def __init__(self, game):
GameChild.__init__(self, game)
self.last_mouse_down_left = None
self.axes_cancelled = {"up": True, "right": True, "down": True, "left": True}
self.joystick = Joystick()
self.delegate = self.get_delegate()
self.load_configuration()
@ -96,9 +97,11 @@ class Input(GameChild):
value = event.value
if -.01 < value < .01:
for command in "up", "right", "down", "left":
self.post_command(command, cancel=True)
if command not in self.any_press_ignored:
self.post_any_command(command, True)
if not self.axes_cancelled[command]:
self.post_command(command, cancel=True)
if command not in self.any_press_ignored:
self.post_any_command(command, True)
self.axes_cancelled[command] = True
else:
if axis == 1:
if value < 0:
@ -113,6 +116,7 @@ class Input(GameChild):
self.post_command(command)
if command not in self.any_press_ignored:
self.post_any_command(command)
self.axes_cancelled[command] = False
def is_command_active(self, command):
if not self.suppressed: