Skip to content

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

Open
@alexispaez

Description

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.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions