Skip to content

Commit

Permalink
Work-around for pseudo-josticks by @Algorithmus #5
Browse files Browse the repository at this point in the history
A bug in PyGame causes some non-joysticks to appear as joysticks: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=710162

@Algorithmus proposed a work-around for that in #5: Ignoring self-acclaimed joysticks with too few axes.
  • Loading branch information
Funatiker committed Mar 4, 2016
1 parent 5f0c45e commit 7bc2dc5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def notify(self, event):
self.event_manager.post(attack_request_ev)

#Handle events generated by game pad
if self.joystick:
if self.joystick and self.joystick.get_numaxes() > 3:
'''
XBox game pad 2. axis: X 3, Y 4
Sony game pad 2. axis: X 3, Y 2
Expand All @@ -83,4 +83,4 @@ def notify(self, event):
if self.joystick.get_button(7):
attack_request_ev = events.MouseButtonDown()
self.event_manager.post(attack_request_ev)


0 comments on commit 7bc2dc5

Please sign in to comment.