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 /// Notifies about the removal of an input device.
8 /// </summary>
9 /// <remarks>
10 /// Device that got removed is the one identified by <see cref="InputEvent.deviceId"/>
11 /// of <see cref="baseEvent"/>.
12 /// </remarks>
13 [StructLayout(LayoutKind.Explicit, Size = InputEvent.kBaseEventSize)]
14 public struct DeviceRemoveEvent : IInputEventTypeInfo
15 {
16 public const int Type = 0x4452454D;
17
18 /// <summary>
19 /// Common event data.
20 /// </summary>
21 [FieldOffset(0)]
22 public InputEvent baseEvent;
23
24 public FourCC typeStatic => Type;
25
26 public unsafe InputEventPtr ToEventPtr()
27 {
28 fixed(DeviceRemoveEvent * ptr = &this)
29 {
30 return new InputEventPtr((InputEvent*)ptr);
31 }
32 }
33
34 public static DeviceRemoveEvent Create(int deviceId, double time = -1)
35 {
36 var inputEvent =
37 new DeviceRemoveEvent {baseEvent = new InputEvent(Type, InputEvent.kBaseEventSize, deviceId, time)};
38 return inputEvent;
39 }
40 }
41}