urho3d/Urho3D — pull request #141 by evolarium (2014-01-20 05:27:02+00:00)
Title: Add support for SDL2 GameControllers

This is mostly the same as the current joystick code. However, the SDL game controller code maps buttons to a predefined interface, which is more convenient.

E_CONTROLLERBUTTONDOWN, E_CONTROLLERBUTTONUP, and E_CONTROLLERAXISMOVE are the new events added.

Button returned can be determined by the following variables:
CONTROLLER_BUTTON_A
CONTROLLER_BUTTON_B
CONTROLLER_BUTTON_X
CONTROLLER_BUTTON_Y
CONTROLLER_BUTTON_BACK
CONTROLLER_BUTTON_GUIDE
CONTROLLER_BUTTON_START
CONTROLLER_BUTTON_LEFTSTICK
CONTROLLER_BUTTON_RIGHTSTICK
CONTROLLER_BUTTON_LEFTSHOULDER
CONTROLLER_BUTTON_RIGHTSHOULDER
CONTROLLER_BUTTON_DPAD_UP
CONTROLLER_BUTTON_DPAD_DOWN
CONTROLLER_BUTTON_DPAD_LEFT
CONTROLLER_BUTTON_DPAD_RIGHT

Axis returned can be determined by the following variables:
CONTROLLER_AXIS_LEFTX
CONTROLLER_AXIS_LEFTY
CONTROLLER_AXIS_RIGHTX
CONTROLLER_AXIS_RIGHTY
CONTROLLER_AXIS_TRIGGERLEFT
CONTROLLER_AXIS_TRIGGERRIGHT

Tested on an Xbox 360 controller and it worked correctly.

Feature request here: https://github.com/urho3d/Urho3D/issues/21