sdlada icon indicating copy to clipboard operation
sdlada copied to clipboard

Usage of Instances and IDs dealing with joysticks and controllers

Open alexispaez opened this issue 5 months ago • 0 comments

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.

alexispaez avatar Sep 11 '24 10:09 alexispaez