Skip to content

Joystick instance IDs have different types in events and methods #963

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

Closed
17cupsofcoffee opened this issue Jan 27, 2020 · 1 comment · Fixed by #964
Closed

Joystick instance IDs have different types in events and methods #963

17cupsofcoffee opened this issue Jan 27, 2020 · 1 comment · Fixed by #964

Comments

@17cupsofcoffee
Copy link
Contributor

17cupsofcoffee commented Jan 27, 2020

#955 changed all of the events' which fields to u32 (with some reasonable justification!). Some of those which values are joystick IDs. If you try to get those same IDs from the Joystick or GameController struct, you currently get given an i32.

It's a minor thing, as I can just cast the value, but it seems a little inconsistent. Should this conversion be handled under the hood, or is this the intended behaviour? If the former, I might submit a PR.

@Cobrand
Copy link
Member

Cobrand commented Jan 28, 2020

You are right, it's not intended behaviour. Negative values are returned when errors happen, but they should be converted to Err(...) in those cases, that's why it's safe to use u32 for valid JoystickIDs. So yeah that should be fixed, feel free to drop a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants