Closed Starland9 closed 1 hour ago
I think this is something too implementation specific to have inside of the enum. The enums already make it easy to make that check yourself (as you've already discovered).
I also don't think these helper names are completely intuitive, if I called isLeft
I wouldn't be sure if it was only true when the direction is only "pure" left
or for all types of left, hence why I think it is better to leave this up to the developer.
Sidenote: If adding isLeft
and isRight
, isUp
and isDown
should also be added.
ok thanks
You can also check for the sign of the direction X value to determine if it is left or right. Which imho is how I would do it, that way no matter what the enum says I can just check left or right
without having to create a list and do a contains on it.
@Starland9 I checked with the rest and they agreed.
I'll close this, but thanks for a well written issue! :)
What could be improved
The JoystickDirection enum in Flame could be improved by adding isLeft and isRight properties. These properties would allow developers to easily determine whether a joystick direction is left or right, without having to manually check the direction value
Why should this be improved
This improvement is necessary to make it easier for developers to work with joysticks in Flame. By providing a straightforward way to determine whether a joystick direction is left or right, developers can simplify their code and reduce the risk of errors.
Risks
There are no major risks associated with this improvement, as it would not change the existing API or functionality of Flame. However, it is possible that this improvement may require minor modifications to existing code that uses the joystick functionality.
More information
I propose adding isLeft and isRight properties to the JoystickDirection enum in Flame. These properties would be boolean values that indicate whether a joystick direction is left or right. For example:
Other