Skip to content
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

Usage of Instances and IDs dealing with joysticks and controllers #107

Open
alexispaez opened this issue Sep 11, 2024 · 0 comments
Open

Comments

@alexispaez
Copy link
Contributor

SDL.Inputs.Joysticks.Instance returns a type Instances. The Instances type is mapped to SDL2's SDL_JoystickID and defined in SDL.Inputs.Joysticks as

   type Instances is range 0 .. 2 ** 31 - 1 with
     Convention => C,
     Size       => 32;

On the other hand, the events for Axis, Button and Device all have the "which" member defined as an IDs, which is as defined in SDL.Events.Joysticks as:

   type IDs is range -2 ** 31 .. 2 ** 31 - 1 with
     Convention => C,
     Size       => 32;

This forces a cast when checking the joystick events, I think that both could be made the same. There doesn't seem to be any other uses for SDL.Events.Joysticks.IDs anywhere else in the current sdlada codebase.

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

No branches or pull requests

1 participant