public void UpdateBatteryState() { XInputBatteryInformation headset = new XInputBatteryInformation(), gamepad = new XInputBatteryInformation(); XInputNative.XInputGetBatteryInformation(_playerIndex, (byte)BatteryDeviceType.BATTERY_DEVTYPE_GAMEPAD, ref gamepad); XInputNative.XInputGetBatteryInformation(_playerIndex, (byte)BatteryDeviceType.BATTERY_DEVTYPE_HEADSET, ref headset); BatteryInformationHeadset = headset; BatteryInformationGamepad = gamepad; }
public static extern int XInputGetBatteryInformation ( int dwUserIndex, // Index of the gamer associated with the device byte devType, // Which device on this user index ref XInputBatteryInformation pBatteryInformation // Contains the level and types of batteries );