Пример #1
0
        /// <summary>
        /// Gets the devices for a particular <see cref="DeviceType"/> and <see cref="DeviceEnumerationFlags"/>.
        /// </summary>
        /// <param name="deviceType">Type of the device.</param>
        /// <param name="deviceEnumFlags">The device enum flags.</param>
        /// <returns>A collection of <see cref="DeviceInstance"/></returns>
        public IList <DeviceInstance> GetDevices(DeviceType deviceType, DeviceEnumerationFlags deviceEnumFlags)
        {
            var enumDevicesCallback = new EnumDevicesCallback();

            EnumDevices((int)deviceType, enumDevicesCallback.NativePointer, IntPtr.Zero, deviceEnumFlags);
            return(enumDevicesCallback.DeviceInstances);
        }
Пример #2
0
        public void PrintInputDevices(DeviceEnumerationFlags inputDeviceStatus)
        {
            IList <DeviceInstance> attachedInputDevices = this.m_DirectInput.GetDevices(DeviceClass.GameController, inputDeviceStatus);

            if (!attachedInputDevices.Any())
            {
                Console.WriteLine("No Game Controllers were found");
                return;
            }

            foreach (DeviceInstance device in attachedInputDevices)
            {
                Console.WriteLine("Game Controller Product Name: " + device.ProductName);
            }
        }
Пример #3
0
 public IList <DeviceInstance> GetDevices(DeviceClass deviceClass, DeviceEnumerationFlags flags)
 {
     return(_directInput.GetDevices(deviceClass, flags));
 }
Пример #4
0
 /// <summary>
 /// Gets the devices for a particular <see cref="DeviceType"/> and <see cref="DeviceEnumerationFlags"/>.
 /// </summary>
 /// <param name="deviceType">Type of the device.</param>
 /// <param name="deviceEnumFlags">The device enum flags.</param>
 /// <returns>A collection of <see cref="DeviceInstance"/></returns>
 public IList<DeviceInstance> GetDevices(DeviceType deviceType, DeviceEnumerationFlags deviceEnumFlags)
 {
     var enumDevicesCallback = new EnumDevicesCallback();
     EnumDevices((int)deviceType, enumDevicesCallback.NativePointer, IntPtr.Zero, deviceEnumFlags);
     return enumDevicesCallback.DeviceInstances;
 }