No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UseWindowsGamingInputCommand.cs 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Runtime.InteropServices;
  2. using UnityEngine.InputSystem.Utilities;
  3. namespace UnityEngine.InputSystem.LowLevel
  4. {
  5. /// <summary>
  6. // Command to enable or disable Windows.Gaming.Input native backend.
  7. // Send it to deviceId 0 as it's a special "global" IOCTL that gets routed internally.
  8. /// </summary>
  9. [StructLayout(LayoutKind.Explicit, Size = kSize)]
  10. internal struct UseWindowsGamingInputCommand : IInputDeviceCommandInfo
  11. {
  12. public static FourCC Type { get { return new FourCC('U', 'W', 'G', 'I'); } }
  13. internal const int kSize = InputDeviceCommand.kBaseCommandSize + sizeof(byte);
  14. [FieldOffset(0)]
  15. public InputDeviceCommand baseCommand;
  16. [FieldOffset(InputDeviceCommand.kBaseCommandSize)]
  17. public byte enable;
  18. public FourCC typeStatic
  19. {
  20. get { return Type; }
  21. }
  22. public static UseWindowsGamingInputCommand Create(bool enable)
  23. {
  24. return new UseWindowsGamingInputCommand
  25. {
  26. baseCommand = new InputDeviceCommand(Type, kSize),
  27. enable = (byte)(enable ? 1 : 0)
  28. };
  29. }
  30. }
  31. }