Beispiel #1
0
        /// <summary>
        /// Function to acquire state of axial of chosen joy-stick
        /// </summary>
        /// <returns>State of axial of chosen joy-stick</returns>
        internal static List <double> GetAxises()
        {
            List <double> axises = new List <double>();

            if (currentDevice < 0 || currentDevice >= JoystickManager.AttachedJoysticks.Length)
            {
                currentDevice = -1;
                return(axises);
            }

            for (int i = 0; i < JoystickManager.AttachedJoysticks[currentDevice].ButtonCount(); i++)
            {
                axises.Add(JoystickManager.GetAxis(currentDevice, i));
            }
            return(axises);
        }
Beispiel #2
0
        /// <summary>
        /// Function to acquire the state of the button of chosen joy-stick
        /// </summary>
        /// <returns>State of the button of chosen joy-stick</returns>
        internal static List <ButtonState> GetButtonsState()
        {
            List <ButtonState> buttonsState = new List <ButtonState>();

            if (currentDevice < 0 || currentDevice >= JoystickManager.AttachedJoysticks.Length)
            {
                currentDevice = -1;
                return(buttonsState);
            }

            for (int i = 0; i < JoystickManager.AttachedJoysticks[currentDevice].ButtonCount(); i++)
            {
                buttonsState.Add(JoystickManager.GetButton(currentDevice, i));
            }
            return(buttonsState);
        }
Beispiel #3
0
 /// <summary>
 /// Function to initialize
 /// </summary>
 internal static void Init()
 {
     Joystick        = new JoystickManager();
     currentDevice   = -1;
     lastButtonState = new List <ButtonState>();
 }