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.

WarpMousePositionCommand.cs 1016B

123456789101112131415161718192021222324252627282930313233
  1. using System.Runtime.InteropServices;
  2. using UnityEngine.InputSystem.Utilities;
  3. namespace UnityEngine.InputSystem.LowLevel
  4. {
  5. [StructLayout(LayoutKind.Explicit, Size = kSize)]
  6. internal struct WarpMousePositionCommand : IInputDeviceCommandInfo
  7. {
  8. public static FourCC Type { get { return new FourCC('W', 'P', 'M', 'S'); } }
  9. internal const int kSize = InputDeviceCommand.kBaseCommandSize + sizeof(float) * 2;
  10. [FieldOffset(0)]
  11. public InputDeviceCommand baseCommand;
  12. [FieldOffset(InputDeviceCommand.kBaseCommandSize)]
  13. public Vector2 warpPositionInPlayerDisplaySpace;
  14. public FourCC typeStatic
  15. {
  16. get { return Type; }
  17. }
  18. public static WarpMousePositionCommand Create(Vector2 position)
  19. {
  20. return new WarpMousePositionCommand
  21. {
  22. baseCommand = new InputDeviceCommand(Type, kSize),
  23. warpPositionInPlayerDisplaySpace = position
  24. };
  25. }
  26. }
  27. }