Exemplo n.º 1
0
        /// <summary>
        /// Gets the controller model.
        /// </summary>
        /// <param name="guid">The GUID of the joystick.</param>
        /// <param name="capabilities">The capabilities of the joystick.</param>
        internal static ControllerModels GetControllerModel(Guid guid, JoystickCapabilities capabilities)
        {
            string id = GetControllerID(guid);

            if (ControllerUnbalance.IsCompatibleController(id, capabilities))
            {
                // The controller is a USB controller by Unbalance
                return(ControllerModels.Unbalance);
            }
            if (ControllerClassic.IsCompatibleController(capabilities))
            {
                // The controller is a classic console controller
                return(ControllerModels.Classic);
            }
            // Unsupported controller
            return(ControllerModels.Unsupported);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the input from the controller.
        /// </summary>
        internal static void GetInput()
        {
            // Store the current notches so we can later tell if they have been moved
            PreviousBrakeNotch = BrakeNotch;
            PreviousPowerNotch = PowerNotch;

            // Read the input from the controller according to the type
            switch (ControllerModel)
            {
            case ControllerModels.Classic:
                ControllerClassic.ReadInput(Joystick.GetState(ConnectedControllers[activeControllerGuid]));
                return;

            case ControllerModels.Unbalance:
                ControllerUnbalance.ReadInput(Joystick.GetState(ConnectedControllers[activeControllerGuid]));
                return;
            }
        }
Exemplo n.º 3
0
 private void buttonCalibrate_Click(object sender, EventArgs e)
 {
     timer1.Stop();
     ControllerClassic.Calibrate();
     timer1.Start();
 }