-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make analog sticks emit "fake" digital actions for left/right/up/down… #1746
Conversation
… movement, and add ID's that make it simple to use them. Makes it easy to use an Analog stick as if it were a DPAD, a very popular input pattern. This behavior was already implemented on legacy, but the API for it was buried. I added top level FlxGamepadInputID's for the digital events, and refactored things so that Next can emit these events as well. Also, I added a "value" property to the FlxGamepadButton for storing last frame's analog input value, which should remove the requirement for FlxActions to call check() every frame in order to get accurate JUST_MOVED / JUST_STOPPED behavior.
@@ -261,10 +269,10 @@ class FlxGamepad implements IFlxDestroyable | |||
manager = null; | |||
|
|||
#if FLX_JOYSTICK_API | |||
hat = FlxDestroyUtil.put(hat); | |||
hat = FlxDestroyUtil.put(hat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fyi, I'm not a fan of this formatting for vertical alignment. That's just a lot of extra maintenance effort with little benefit.
…hy I had it at the bottom before
@Gama11: I think I got everything you mentioned. Anything else I should hit before squashing? |
The mapping classes still use |
@Gama11 Do you have any FlashDevelop or other text editor macro that check this code styles? |
@adrianulima No.. Somebody suggested using checkstyle a while ago to check the code style on Travis.. However I never looked into how well that tool works, and I also dislike idea of having failed Travis builds because of code stlye issues... What's really needed is an auto-formatter for Haxe. @larsiusprime Squash? :) |
Actually, checkstyle seems like a great tool, I should've looked into that way earlier... |
… movement, and add ID's that make it simple to use them. Makes it easy to use an Analog stick as if it were a DPAD, a very popular input pattern.
This behavior was already implemented on legacy, but the API for it was buried. I added top level FlxGamepadInputID's for the digital events, and refactored things so that Next can emit these events as well.
Also, I added a "value" property to the FlxGamepadButton for storing last frame's analog input value, which should remove the requirement for FlxActions to call check() every frame in order to get accurate JUST_MOVED / JUST_STOPPED behavior.
(This pull request helps the FlxAction PR, but can be considered in isolation and does not depend on it)