Пример #1
0
        public void ReadState()
        {
            var inputState = new XINPUT_STATE();

            _driver.GetState(_dwUserIndex, ref inputState);

            PreviousInputState = InputState;
            InputState         = new InputState(inputState);
            if (PreviousInputState == null)
            {
                PreviousInputState = InputState;
            }

            var batteryInformation = new XINPUT_BATTERY_INFORMATION();

            _driver.GetBatteryInformation(_dwUserIndex, _devType, ref batteryInformation);

            PreviousBatteryState = BatteryState;
            BatteryState         = new BatteryState(batteryInformation);
            if (PreviousBatteryState == null)
            {
                PreviousBatteryState = BatteryState;
            }
        }
Пример #2
0
 public static uint XInputGetBatteryInformation(uint dwUserIndex, byte devType,
     ref XINPUT_BATTERY_INFORMATION pBatteryInformation)
 {
     return OriginalXInputGetBatteryInformationFunction.Value(dwUserIndex, devType, ref pBatteryInformation);
 }
Пример #3
0
 public static uint XInputGetBatteryInformation(uint dwUserIndex, byte devType,
                                                ref XINPUT_BATTERY_INFORMATION pBatteryInformation)
 {
     return(OriginalXInputGetBatteryInformationFunction.Value(dwUserIndex, devType, ref pBatteryInformation));
 }
Пример #4
0
 /// <summary>
 /// XInputGetBatteryInfomation
 /// https://msdn.microsoft.com/ja-jp/library/windows/desktop/microsoft.directx_sdk.reference.xinputgetbatteryinformation.aspx
 /// <summary>
 public static uint GetBatteryInformation(uint dwUserIndex, byte devType, ref XINPUT_BATTERY_INFORMATION pBatteryInformation)
 {
     return(funcXInputGetBatteryInformation(dwUserIndex, devType, ref pBatteryInformation));
 }
Пример #5
0
 public BatteryState(XINPUT_BATTERY_INFORMATION batteryInformation)
 {
     Type  = Helper.EnumParse <BatteryType>(batteryInformation.BatteryType.ToString());
     Level = Helper.EnumParse <BatteryLevel>(batteryInformation.BatteryLevel.ToString());
 }
Пример #6
0
 public static extern uint XInputGetBatteryInformation
 (
     [In] uint dwUserIndex,                               // Index of the gamer associated with the device
     [In] byte devType,                                   // Which device on this user index
     [Out] XINPUT_BATTERY_INFORMATION pBatteryInformation // Contains the level and types of batteries
 );