I've got a XBox360 controller which I'd like to use as input for an application.
What I can't work out is the best-practice way to expose this via an interface.
Behind the scenes, the class which handles the controller(s) relies on polling button state.
I initially tried something link:
Event ButtonPressed() as ButtonEnum
This is a little limited in that it only supports button presses, not holds / patterns (press twice, etc.)
The next idea was to simply expose the button state to the app eg
Property RedPressed as Boolean Property StartPressed as Boolean Property Thumb1XAxis as Double
This is very flexible but really it forces too much work into the app and requires the app to poll - I'd prefer event driven if possible.
I considered adding multiple events eg:
Event ButtonPressed(Button as ButtonEnum) Event ButtonPressedTwice(Button as ButtonEnum) Event ButtonHeldStart(Button as ButtonEnum) Event ButtonHeldEnd(Button as ButtonEnum)
but this seems a little clunky and was a real pain on the "Bind button" screen.
Can someone please point me at the "correct" way to handle inputs from controllers.
NB: I'm using SlimDX inside the class which implements the interface. This allows me to read state very easily. Any alternatives which would solve my problem are also appreciated