HaxeFlixel/flixel — pull request #880 by Gama11 (2014-02-12 12:20:41+00:00)
Title: Add flash gamepad support, closes #755

This adds gamepad support for flash. This means that by default, the users will have to target FP 11.8 without `FLX_NO_GAMEPAD` which makes this a breaking change. The old `Project.xml` files still have 11.2.

Unfortunately, the gameinput API in AS3 is quite a bit different than the OpenFL Joystick API, here are some noteworthy things:

- The button IDs are different. I already updated `XBoxButtonID.hx` and `LogitechButtonID.hx`, but we will need some volunteers to do the same for `OuyaButtonID.hx` and `PS3ButtonID.hx`.

- The y axis of my xbox controller is inverted in flash (not the one of the logitech one though). This led to the split of `FlxGamepad.getAxis()` into `getXAxis()` and `getYAxis()` as a workaround to make this consistent across targets. We have to figure out if the y axis is inversed on other targets as well and implement the workaround accordingly (luckily it's easy to figure out what type of controller you're dealing with in the flash gamepad API)

- I don't think there is a way to make the dpad work consistently across targets. In flash, they are treated as regular buttons, while in OpenFL, there is a seperate event (`JoystickEvent.HAT_MOVE`). This will require seperate logic on the user end for now (maybe can be solved via the input mapping helper class, #752).

I have pushed an updated version of the GamepadTest demo [to my fork](https://github.com/Gama11/flixel-demos/blob/dev/Input/GamepadTest/source/PlayState.hx). Click here to view the compiled [.swf]().