namespace Brutal.SdlApi; /// /// A mapping between one joystick input and a gamepad control (SDL_GamepadBinding). /// /// /// /// Hand-written rather than generated: the native SDL_GamepadBinding struct contains two /// anonymous nested unions (input, output), which the generator's struct pass cannot /// mirror as a flat blittable type (see Generated/SKIPPED.md's "Skipped struct types" /// section). This explicit-layout struct reproduces the native field offsets by hand instead, so /// Task 4's can copy the native bytes directly via a /// pointer cast. /// /// /// Layout (verified against SDL_gamepad.h): input_type (4 bytes) at offset 0; the /// input union (its largest member, the axis triple of three ints, is 12 bytes) at /// offset 4; output_type (4 bytes) at offset 16; the output union (again a 12-byte /// axis triple at its largest) at offset 20. Total size 32 bytes, 4-byte aligned, no trailing /// padding needed. /// /// [StructLayout(LayoutKind.Explicit, Size = 32)] public struct SdlGamepadBinding { /// Which kind of joystick input // describes. [FieldOffset(0)] public SdlGamepadBindingType InputType; /// Valid when is . [FieldOffset(4)] public int InputButton; /// Valid when is . [FieldOffset(4)] public int InputAxis; /// Valid when is . [FieldOffset(8)] public int InputAxisMin; /// Valid when is . [FieldOffset(12)] public int InputAxisMax; /// Valid when is . [FieldOffset(4)] public int InputHat; /// Valid when is . [FieldOffset(8)] public int InputHatMask; /// Which kind of gamepad control / describes. [FieldOffset(16)] public SdlGamepadBindingType OutputType; /// Valid when is . [FieldOffset(20)] public SdlGamepadButton OutputButton; /// Valid when is . [FieldOffset(20)] public SdlGamepadAxis OutputAxis; /// Valid when is . [FieldOffset(24)] public int OutputAxisMin; /// Valid when is . [FieldOffset(28)] public int OutputAxisMax; }