A game about forced loneliness, made by TACStudios
1using System.Runtime.InteropServices;
2using UnityEngine.InputSystem.Utilities;
3
4////REVIEW: should this have optional data that identifies *what* has changed?
5
6namespace UnityEngine.InputSystem.LowLevel
7{
8 /// <summary>
9 /// Indicates that the configuration of a device has changed.
10 /// </summary>
11 /// <seealso cref="InputSystem.QueueConfigChangeEvent"/>
12 /// <seealso cref="InputDevice.OnConfigurationChanged"/>
13 [StructLayout(LayoutKind.Explicit, Size = InputEvent.kBaseEventSize)]
14 public struct DeviceConfigurationEvent : IInputEventTypeInfo
15 {
16 public const int Type = 0x44434647;
17
18 [FieldOffset(0)]
19 public InputEvent baseEvent;
20
21 ////REVIEW: have some kind of payload that allows indicating what changed in the config?
22
23 public FourCC typeStatic => Type;
24
25 public unsafe InputEventPtr ToEventPtr()
26 {
27 fixed(DeviceConfigurationEvent * ptr = &this)
28 {
29 return new InputEventPtr((InputEvent*)ptr);
30 }
31 }
32
33 public static DeviceConfigurationEvent Create(int deviceId, double time)
34 {
35 var inputEvent = new DeviceConfigurationEvent();
36 inputEvent.baseEvent = new InputEvent(Type, InputEvent.kBaseEventSize, deviceId, time);
37 return inputEvent;
38 }
39 }
40}