using System.Runtime.InteropServices;
using UnityEngine.InputSystem.Utilities;
namespace UnityEngine.InputSystem.LowLevel
{
///
/// Event that causes the state of an to be reset (see ).
///
///
[StructLayout(LayoutKind.Explicit, Size = InputEvent.kBaseEventSize)]
public struct DeviceResetEvent : IInputEventTypeInfo
{
public const int Type = 0x44525354; // DRST
///
/// Common event data.
///
[FieldOffset(0)]
public InputEvent baseEvent;
///
/// Whether to also reset controls.
///
[FieldOffset(InputDeviceCommand.kBaseCommandSize)]
public bool hardReset;
public FourCC typeStatic => Type;
public static DeviceResetEvent Create(int deviceId, bool hardReset = false, double time = -1)
{
var inputEvent =
new DeviceResetEvent {baseEvent = new InputEvent(Type, InputEvent.kBaseEventSize, deviceId, time)};
inputEvent.hardReset = hardReset;
return inputEvent;
}
}
}