X Tutup
Skip to content

Joystick Single Axis Functions#18

Merged
dmadison merged 2 commits intomasterfrom
joysticks
Jul 25, 2019
Merged

Joystick Single Axis Functions#18
dmadison merged 2 commits intomasterfrom
joysticks

Conversation

@dmadison
Copy link
Owner

Adds two functions for manipulating the joystick axes separately: setJoystickX and setJoystickY. For those rare cases where you want to only set one axis, you don't need to determine the pre-scaled 'center' value for the other axis.

Note that both axes still share the same input range values (and I have no plans to change that). But I think these will be useful functions for those mapping non-joystick devices to the joystick outputs.

This pull request also changes the 4-button joystick function to use 'if' statements rather than multiplication in the back-end. It's more literally what I was trying to do, and it avoids requiring the compiler to optimize away the multiplication operation.

dmadison added 2 commits July 25, 2019 00:11
Multiplication was just a short-hand for the 'if' statement logic anyways, counting on the compiler to do the optimization. Better to just write it out.
If for whatever reason you only want to set one axis, you can now do so without having to figure out where the middle of the pre-scaled range is. For now the X/Y range is still being treated the same because this is an edge case, not the main use (i.e. most users will still use joysticks as joysticks).
@dmadison dmadison merged commit 60fe179 into master Jul 25, 2019
@dmadison dmadison deleted the joysticks branch July 25, 2019 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

X Tutup