File size: 1,295 Bytes
18a519f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | using System.Runtime.InteropServices;
using UnityEngine.InputSystem.Utilities;
namespace UnityEngine.InputSystem.LowLevel
{
/// <summary>
/// Event that causes the state of an <see cref="InputDevice"/> to be reset (see <see cref="InputSystem.ResetDevice"/>).
/// </summary>
/// <seealso cref="InputSystem.ResetDevice"/>
[StructLayout(LayoutKind.Explicit, Size = InputEvent.kBaseEventSize)]
public struct DeviceResetEvent : IInputEventTypeInfo
{
public const int Type = 0x44525354; // DRST
/// <summary>
/// Common event data.
/// </summary>
[FieldOffset(0)]
public InputEvent baseEvent;
/// <summary>
/// Whether to also reset <see cref="Layouts.InputControlAttribute.dontReset"/> controls.
/// </summary>
[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;
}
}
}
|