public static int HALGetJoystickButtons(byte joystickNum, ref HALJoystickButtons buttons) { var b = halData["joysticks"][joystickNum]["buttons"]; uint total = 0; for (int i = 1; i < b.Length; i++) { total = total + (uint)((b[i] ? 1 : 0) << i - 1); } buttons.buttons = total; buttons.count = (byte)(b.Length - 1); return 0; }
public static extern int HALGetJoystickButtons(byte joystickNum, ref HALJoystickButtons buttons);