A game about forced loneliness, made by TACStudios
1using System.Runtime.InteropServices;
2using UnityEngine.InputSystem.Utilities;
3
4namespace UnityEngine.InputSystem.LowLevel
5{
6 /// <summary>
7 /// Event that causes the state of an <see cref="InputDevice"/> to be reset (see <see cref="InputSystem.ResetDevice"/>).
8 /// </summary>
9 /// <seealso cref="InputSystem.ResetDevice"/>
10 [StructLayout(LayoutKind.Explicit, Size = InputEvent.kBaseEventSize)]
11 public struct DeviceResetEvent : IInputEventTypeInfo
12 {
13 public const int Type = 0x44525354; // DRST
14
15 /// <summary>
16 /// Common event data.
17 /// </summary>
18 [FieldOffset(0)]
19 public InputEvent baseEvent;
20
21 /// <summary>
22 /// Whether to also reset <see cref="Layouts.InputControlAttribute.dontReset"/> controls.
23 /// </summary>
24 [FieldOffset(InputDeviceCommand.kBaseCommandSize)]
25 public bool hardReset;
26
27 public FourCC typeStatic => Type;
28
29 public static DeviceResetEvent Create(int deviceId, bool hardReset = false, double time = -1)
30 {
31 var inputEvent =
32 new DeviceResetEvent {baseEvent = new InputEvent(Type, InputEvent.kBaseEventSize, deviceId, time)};
33 inputEvent.hardReset = hardReset;
34 return inputEvent;
35 }
36 }
37}