Stanyko
Stanyko

Reputation: 195

Python, pygame - gamepad with 8 way d-pad

Is pygame (pygame.locals.JOYHATMOTION) able to catch all directions from a gamepad with 8 way d-pad? I mean function get_hat, that returns tuples.

Upvotes: 0

Views: 1684

Answers (1)

Dan D.
Dan D.

Reputation: 74645

Yes, http://www.pygame.org/docs/ref/joystick.html#Joystick.get_hat says it can handle an 8 directional pad.

the possible return values of get_hat are in the following list:

>>> [(x,y) for x in [-1,0,1] for y in [-1,0,1]]
[(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 0), (0, 1), (1, -1), (1, 0), (1, 1)]

Upvotes: 1

Related Questions