Example #1
0
        /// <summary>
        /// Initializes a new JoystickState class.
        /// </summary>
        /// <param name="x">The X.</param>
        /// <param name="y">The Y.</param>
        /// <param name="z">The Z.</param>
        /// <param name="r">The R.</param>
        /// <param name="u">The U.</param>
        /// <param name="v">The V.</param>
        /// <param name="pointOfView">The PointOfView.</param>
        /// <param name="buttonStates">The ButtonStates.</param>
        internal JoystickState(uint x, uint y, uint z, uint r, uint u, uint v, PointOfView pointOfView,
                               Dictionary <int, bool> buttonStates)
        {
            X           = x;
            Y           = y;
            Z           = z;
            R           = r;
            U           = u;
            V           = v;
            PointOfView = pointOfView;

            if (buttonStates.Count != 32)
            {
                throw new ArgumentException("ButtonStates need 32 entries to be accepted.");
            }

            Button1  = new JoystickButton(buttonStates[0]);
            Button2  = new JoystickButton(buttonStates[1]);
            Button3  = new JoystickButton(buttonStates[2]);
            Button4  = new JoystickButton(buttonStates[3]);
            Button5  = new JoystickButton(buttonStates[4]);
            Button6  = new JoystickButton(buttonStates[5]);
            Button7  = new JoystickButton(buttonStates[6]);
            Button8  = new JoystickButton(buttonStates[7]);
            Button9  = new JoystickButton(buttonStates[8]);
            Button10 = new JoystickButton(buttonStates[9]);
            Button11 = new JoystickButton(buttonStates[10]);
            Button12 = new JoystickButton(buttonStates[11]);
            Button13 = new JoystickButton(buttonStates[12]);
            Button14 = new JoystickButton(buttonStates[13]);
            Button15 = new JoystickButton(buttonStates[14]);
            Button16 = new JoystickButton(buttonStates[15]);
            Button17 = new JoystickButton(buttonStates[16]);
            Button18 = new JoystickButton(buttonStates[17]);
            Button19 = new JoystickButton(buttonStates[18]);
            Button20 = new JoystickButton(buttonStates[19]);
            Button21 = new JoystickButton(buttonStates[20]);
            Button22 = new JoystickButton(buttonStates[21]);
            Button23 = new JoystickButton(buttonStates[22]);
            Button24 = new JoystickButton(buttonStates[23]);
            Button25 = new JoystickButton(buttonStates[24]);
            Button26 = new JoystickButton(buttonStates[25]);
            Button27 = new JoystickButton(buttonStates[26]);
            Button28 = new JoystickButton(buttonStates[27]);
            Button29 = new JoystickButton(buttonStates[28]);
            Button30 = new JoystickButton(buttonStates[29]);
            Button31 = new JoystickButton(buttonStates[30]);
            Button32 = new JoystickButton(buttonStates[31]);
        }
Example #2
0
        /// <summary>
        /// Initializes a new JoystickState class.
        /// </summary>
        /// <param name="x">The X.</param>
        /// <param name="y">The Y.</param>
        /// <param name="z">The Z.</param>
        /// <param name="r">The R.</param>
        /// <param name="u">The U.</param>
        /// <param name="v">The V.</param>
        /// <param name="pointOfView">The PointOfView.</param>
        /// <param name="buttonStates">The ButtonStates.</param>
        internal JoystickState(uint x, uint y, uint z, uint r, uint u, uint v, PointOfView pointOfView,
            Dictionary<int, bool> buttonStates)
        {
            X = x;
            Y = y;
            Z = z;
            R = r;
            U = u;
            V = v;
            PointOfView = pointOfView;

            if (buttonStates.Count != 32)
            {
                throw new ArgumentException("ButtonStates need 32 entries to be accepted.");
            }

            Button1 = new JoystickButton(buttonStates[0]);
            Button2 = new JoystickButton(buttonStates[1]);
            Button3 = new JoystickButton(buttonStates[2]);
            Button4 = new JoystickButton(buttonStates[3]);
            Button5 = new JoystickButton(buttonStates[4]);
            Button6 = new JoystickButton(buttonStates[5]);
            Button7 = new JoystickButton(buttonStates[6]);
            Button8 = new JoystickButton(buttonStates[7]);
            Button9 = new JoystickButton(buttonStates[8]);
            Button10 = new JoystickButton(buttonStates[9]);
            Button11 = new JoystickButton(buttonStates[10]);
            Button12 = new JoystickButton(buttonStates[11]);
            Button13 = new JoystickButton(buttonStates[12]);
            Button14 = new JoystickButton(buttonStates[13]);
            Button15 = new JoystickButton(buttonStates[14]);
            Button16 = new JoystickButton(buttonStates[15]);
            Button17 = new JoystickButton(buttonStates[16]);
            Button18 = new JoystickButton(buttonStates[17]);
            Button19 = new JoystickButton(buttonStates[18]);
            Button20 = new JoystickButton(buttonStates[19]);
            Button21 = new JoystickButton(buttonStates[20]);
            Button22 = new JoystickButton(buttonStates[21]);
            Button23 = new JoystickButton(buttonStates[22]);
            Button24 = new JoystickButton(buttonStates[23]);
            Button25 = new JoystickButton(buttonStates[24]);
            Button26 = new JoystickButton(buttonStates[25]);
            Button27 = new JoystickButton(buttonStates[26]);
            Button28 = new JoystickButton(buttonStates[27]);
            Button29 = new JoystickButton(buttonStates[28]);
            Button30 = new JoystickButton(buttonStates[29]);
            Button31 = new JoystickButton(buttonStates[30]);
            Button32 = new JoystickButton(buttonStates[31]);
        }