Beispiel #1
0
        /// <summary>
        /// Attach a device to the input manager.
        /// </summary>
        /// <param name="inputDevice">The input device to attach.</param>
        public static void AttachDevice(InputDevice inputDevice)
        {
            AssertIsSetup();

            if (!inputDevice.IsSupportedOnThisPlatform)
            {
                return;
            }

            if (inputDevice.IsAttached)
            {
                return;
            }

            if (!devices.Contains(inputDevice))
            {
                devices.Add(inputDevice);
                devices.Sort((d1, d2) => d1.SortOrder.CompareTo(d2.SortOrder));
            }

            inputDevice.OnAttached();

            if (OnDeviceAttached != null)
            {
                OnDeviceAttached(inputDevice);
            }
        }