Benedict Lee

makes videogames, music, software, writings

hXInput

This allows full native support for the Xbox 360 controller, with all buttons, sticks and triggers accessible on Windows. Rumble is also supported. It also allows you to turn on and off controllers without issue even while your application is running.

hXInput should work with 32-bit and 64-bit versions of Windows 8, 7, Vista, and possibly XP (unconfirmed).

The compiled DLL and source is available, with 2 haxe libraries to interface with the dll. One is a basic library (in example folder) which just mirrors the DLL’s api. This is if you wish to implement your own input handling methods.

The other library (in example2 folder) is fully developed with plenty of functions to get and send input.

For a basic input library, refer to or use Xbox360Input.hx in the example folder for a class with all the basic necessary functions to interface with XInput.
Usage with more complete haxe library

For a more complete input library, use example2. To use the library in example2, call ControllerInput.initialize() at application start. Then ensure you call ControllerInput.update() every frame, prior to your entity update loop. the only class you have to interact with is ControllerInput.

If you’re using openfl, an alternative is: openfl-xinput (https://github.com/Sunjammer/openfl-xinput). That requires openfl though, while hXInput does not.

Next Post

Previous Post

© 2024 Benedict Lee

Theme by Anders Norén