Esempio n. 1
0
 //---------------------------------------------------------------------
 private void connectToJoystick(Joystick joystick)
 {
     while (true)
     {
         string sticks = joystick.FindJoysticks();
         if (sticks != null)
         {
             if (joystick.AcquireJoystick(sticks))
             {
                 enableTimer();
                 break;
             }
         }
     }
 }
Esempio n. 2
0
        //---------------------------------------------------------------------
        private bool connectToJoystick(Joystick joystick)
        {
            while (true)
            {
                string sticks = joystick.FindJoysticks(out this.controllersList);
                if (sticks == null)
                {
                    return(false);
                }

                if (joystick.AcquireJoystick(sticks))
                {
                    enableTimer();
                    break;
                }
            }

            return(true);
        }
        /// <summary>
        /// Find the attached joystick
        /// </summary>
        /// <param name="joystick">This will be the handles joystick object</param>
        /// <param name="joyStickTimer">JoystickTimer (Control) that ticks for the joystick</param>
        /// <returns></returns>
        public static bool connectToJoystick(Joystick joystick, Timer joyStickTimer)
        {
            while (true)
            {
                string sticks = joystick.FindJoysticks();

                if (sticks != null)
                {
                    if (joystick.AcquireJoystick(sticks))
                    {
                        joyStickTimer.Enabled = true;
                        break;  //Joystick found
                    }
                }
                else
                {
                    return false;   //Joystick not found
                }

            }
            return true;
        }