示例#1
0
        public static List <GenericInput> GetNewInputDevices(IntPtr windowHandle, List <GenericInput> currentDevices)
        {
            List <GenericInput> newDevices        = new List <GenericInput>();
            WiimoteCollection   wiiMoteCollection = new WiimoteCollection();

            try
            {
                wiiMoteCollection.FindAllWiimotes();
            }
            catch (WiimoteNotFoundException) { }
            catch (WiimoteException)
            {
                Console.WriteLine("Wiimote error");
            }

            foreach (Wiimote wiimote in wiiMoteCollection)
            {
                if (!CheckIfDeviceExists(wiimote, currentDevices))
                {
                    WiiMoteInput input = new WiiMoteInput(wiimote);
                    wiimote.SetLEDs(false, false, false, false);

                    newDevices.Add(input);
                }
            }

            return(newDevices);
        }
        public static List<GenericInput> GetNewInputDevices(IntPtr windowHandle, List<GenericInput> currentDevices)
        {
            List<GenericInput> newDevices = new List<GenericInput>();
            WiimoteCollection wiiMoteCollection = new WiimoteCollection();

            try
            {
                wiiMoteCollection.FindAllWiimotes();
            }
            catch (WiimoteNotFoundException) { }
            catch (WiimoteException)
            {
                Console.WriteLine("Wiimote error");
            }

            foreach (Wiimote wiimote in wiiMoteCollection)
            {
                if (!CheckIfDeviceExists(wiimote, currentDevices))
                {
                    WiiMoteInput input = new WiiMoteInput(wiimote);
                    wiimote.SetLEDs(false, false, false, false);

                    newDevices.Add(input);
                }
            }

            return newDevices;
        }
 public void SetFlags(bool isConnected, bool isFlying, bool isHovering, bool isEmergency)
 {
     for (int i = 0; i < inputDevices.Count; i++)
     {
         if (inputDevices[i] is WiiMoteInput)
         {
             WiiMoteInput wiimoteInput = (WiiMoteInput)inputDevices[i];
             wiimoteInput.SetLEDs(isConnected, isFlying, isHovering, isEmergency);
         }
     }
 }
示例#4
0
        private void AddNewDevices()
        {
            List <GenericInput> newDevices = new List <GenericInput>();

            newDevices.AddRange(KeyboardInput.GetNewInputDevices(windowHandle, inputDevices));
            newDevices.AddRange(JoystickInput.GetNewInputDevices(windowHandle, inputDevices));
            newDevices.AddRange(WiiMoteInput.GetNewInputDevices(windowHandle, inputDevices));
            //newDevices.AddRange(SpeechInput.GetNewInputDevices(windowHandle, inputDevices));

            foreach (GenericInput inputDevice in newDevices)
            {
                AddInputDevice(inputDevice);
                InitInputDevice(inputDevice);
            }
        }