zeh/key-action-binder — pull request #9 by mwgray (2014-11-12 17:47:26+00:00)
Title: Axis activate feature

Okay, this is probably the big one... :-)

Changed interpretGameInputControlChanges to fire distinct events for axis controls that range from negative to positive

reasoning: analog sticks return -1 to 1, which create two distinct maximums for events to activate.
previously the system would fire activate on a -1 to 1 axis when the value passed the zero threshold on the analog stick. meaning if you bind an action to the stick, it would only activate if you went from neutral to right or down.

this commit changes the system a bit to detect if it passes a dead zone value, defaulted to 0.5. If it does, it will activate the given value. However, since the GamepadControls uses values like STICK_LEFT_X/stick_left_x to match up what Flash returns, the new interpretGameInputControlChanges has to modify the string value based on the axis direction. So now stick_left_x, becomes stick_left_x+ or stick_left_x-, depending on the direction of the press. This means the user needs to suffix their binding calls with +/- based on what they want. Or the constants could be added to GamepadControls, but I didn't want to clutter it.

the +/- is determined by the current value passed in. additionally, because there's no way to know from the current value what the previous value was, when a axis value changes, a secondary call to interpretGameInputControlChanges is made to fake deactivating the previous value. This is to address cases when your analog value goes from +1 to -0.1, which means there was no +values that would have triggered a deactivate of stick_left_x+

this should only affect the behavior of the activate/deactivate action code, all other code should work as before