Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public JoystickData GetState()
        {
            JoystickData ret = new JoystickData();

            WinMM.JOYINFOEX tmpJoyInfo = GetJoyInfoEx();

            ret.ID   = ID;
            ret.Name = Name;

            ret.NumberOfAxes    = NumberOfAxes;
            ret.NumberOfButtons = NumberOfButtons;

            ret.R = tmpJoyInfo.dwRpos;
            ret.U = tmpJoyInfo.dwUpos;
            ret.V = tmpJoyInfo.dwVpos;
            ret.X = tmpJoyInfo.dwXpos;
            ret.Y = tmpJoyInfo.dwYpos;
            ret.Z = tmpJoyInfo.dwZpos;

            ret.Button01 = GetButtonState(WinMM.JOY_BUTTON1, tmpJoyInfo);
            ret.Button02 = GetButtonState(WinMM.JOY_BUTTON2, tmpJoyInfo);
            ret.Button03 = GetButtonState(WinMM.JOY_BUTTON3, tmpJoyInfo);
            ret.Button04 = GetButtonState(WinMM.JOY_BUTTON4, tmpJoyInfo);
            ret.Button05 = GetButtonState(WinMM.JOY_BUTTON5, tmpJoyInfo);
            ret.Button06 = GetButtonState(WinMM.JOY_BUTTON6, tmpJoyInfo);
            ret.Button07 = GetButtonState(WinMM.JOY_BUTTON7, tmpJoyInfo);
            ret.Button08 = GetButtonState(WinMM.JOY_BUTTON8, tmpJoyInfo);
            ret.Button09 = GetButtonState(WinMM.JOY_BUTTON9, tmpJoyInfo);
            ret.Button10 = GetButtonState(WinMM.JOY_BUTTON10, tmpJoyInfo);
            ret.Button11 = GetButtonState(WinMM.JOY_BUTTON11, tmpJoyInfo);
            ret.Button12 = GetButtonState(WinMM.JOY_BUTTON12, tmpJoyInfo);
            ret.Button13 = GetButtonState(WinMM.JOY_BUTTON13, tmpJoyInfo);
            ret.Button14 = GetButtonState(WinMM.JOY_BUTTON14, tmpJoyInfo);
            ret.Button15 = GetButtonState(WinMM.JOY_BUTTON15, tmpJoyInfo);
            ret.Button16 = GetButtonState(WinMM.JOY_BUTTON16, tmpJoyInfo);
            ret.Button17 = GetButtonState(WinMM.JOY_BUTTON17, tmpJoyInfo);
            ret.Button18 = GetButtonState(WinMM.JOY_BUTTON18, tmpJoyInfo);
            ret.Button19 = GetButtonState(WinMM.JOY_BUTTON19, tmpJoyInfo);
            ret.Button20 = GetButtonState(WinMM.JOY_BUTTON20, tmpJoyInfo);
            ret.Button21 = GetButtonState(WinMM.JOY_BUTTON21, tmpJoyInfo);
            ret.Button22 = GetButtonState(WinMM.JOY_BUTTON22, tmpJoyInfo);
            ret.Button23 = GetButtonState(WinMM.JOY_BUTTON23, tmpJoyInfo);
            ret.Button24 = GetButtonState(WinMM.JOY_BUTTON24, tmpJoyInfo);
            ret.Button25 = GetButtonState(WinMM.JOY_BUTTON25, tmpJoyInfo);
            ret.Button26 = GetButtonState(WinMM.JOY_BUTTON26, tmpJoyInfo);
            ret.Button27 = GetButtonState(WinMM.JOY_BUTTON27, tmpJoyInfo);
            ret.Button28 = GetButtonState(WinMM.JOY_BUTTON28, tmpJoyInfo);
            ret.Button29 = GetButtonState(WinMM.JOY_BUTTON29, tmpJoyInfo);
            ret.Button30 = GetButtonState(WinMM.JOY_BUTTON30, tmpJoyInfo);
            ret.Button31 = GetButtonState(WinMM.JOY_BUTTON31, tmpJoyInfo);
            ret.Button32 = GetButtonState(WinMM.JOY_BUTTON32, tmpJoyInfo);

            ret.POV      = tmpJoyInfo.dwPOV;
            ret.POVAngle = tmpJoyInfo.dwPOV / 100.0;

            return(ret);
        }
Ejemplo n.º 2
0
		/// <summary>
		/// 
		/// </summary>
		public JoystickData GetState()
		{
			JoystickData ret = new JoystickData();
			WinMM.JOYINFOEX tmpJoyInfo = GetJoyInfoEx();

			ret.ID = ID;
			ret.Name = Name;

			ret.NumberOfAxes = NumberOfAxes;
			ret.NumberOfButtons = NumberOfButtons;

			ret.R = tmpJoyInfo.dwRpos;
			ret.U = tmpJoyInfo.dwUpos;
			ret.V = tmpJoyInfo.dwVpos;
			ret.X = tmpJoyInfo.dwXpos;
			ret.Y = tmpJoyInfo.dwYpos;
			ret.Z = tmpJoyInfo.dwZpos;

			ret.Button01 = GetButtonState(WinMM.JOY_BUTTON1, tmpJoyInfo);
			ret.Button02 = GetButtonState(WinMM.JOY_BUTTON2, tmpJoyInfo);
			ret.Button03 = GetButtonState(WinMM.JOY_BUTTON3, tmpJoyInfo);
			ret.Button04 = GetButtonState(WinMM.JOY_BUTTON4, tmpJoyInfo);
			ret.Button05 = GetButtonState(WinMM.JOY_BUTTON5, tmpJoyInfo);
			ret.Button06 = GetButtonState(WinMM.JOY_BUTTON6, tmpJoyInfo);
			ret.Button07 = GetButtonState(WinMM.JOY_BUTTON7, tmpJoyInfo);
			ret.Button08 = GetButtonState(WinMM.JOY_BUTTON8, tmpJoyInfo);
			ret.Button09 = GetButtonState(WinMM.JOY_BUTTON9, tmpJoyInfo);
			ret.Button10 = GetButtonState(WinMM.JOY_BUTTON10, tmpJoyInfo);
			ret.Button11 = GetButtonState(WinMM.JOY_BUTTON11, tmpJoyInfo);
			ret.Button12 = GetButtonState(WinMM.JOY_BUTTON12, tmpJoyInfo);
			ret.Button13 = GetButtonState(WinMM.JOY_BUTTON13, tmpJoyInfo);
			ret.Button14 = GetButtonState(WinMM.JOY_BUTTON14, tmpJoyInfo);
			ret.Button15 = GetButtonState(WinMM.JOY_BUTTON15, tmpJoyInfo);
			ret.Button16 = GetButtonState(WinMM.JOY_BUTTON16, tmpJoyInfo);
			ret.Button17 = GetButtonState(WinMM.JOY_BUTTON17, tmpJoyInfo);
			ret.Button18 = GetButtonState(WinMM.JOY_BUTTON18, tmpJoyInfo);
			ret.Button19 = GetButtonState(WinMM.JOY_BUTTON19, tmpJoyInfo);
			ret.Button20 = GetButtonState(WinMM.JOY_BUTTON20, tmpJoyInfo);
			ret.Button21 = GetButtonState(WinMM.JOY_BUTTON21, tmpJoyInfo);
			ret.Button22 = GetButtonState(WinMM.JOY_BUTTON22, tmpJoyInfo);
			ret.Button23 = GetButtonState(WinMM.JOY_BUTTON23, tmpJoyInfo);
			ret.Button24 = GetButtonState(WinMM.JOY_BUTTON24, tmpJoyInfo);
			ret.Button25 = GetButtonState(WinMM.JOY_BUTTON25, tmpJoyInfo);
			ret.Button26 = GetButtonState(WinMM.JOY_BUTTON26, tmpJoyInfo);
			ret.Button27 = GetButtonState(WinMM.JOY_BUTTON27, tmpJoyInfo);
			ret.Button28 = GetButtonState(WinMM.JOY_BUTTON28, tmpJoyInfo);
			ret.Button29 = GetButtonState(WinMM.JOY_BUTTON29, tmpJoyInfo);
			ret.Button30 = GetButtonState(WinMM.JOY_BUTTON30, tmpJoyInfo);
			ret.Button31 = GetButtonState(WinMM.JOY_BUTTON31, tmpJoyInfo);
			ret.Button32 = GetButtonState(WinMM.JOY_BUTTON32, tmpJoyInfo);

			ret.POV = tmpJoyInfo.dwPOV;
			ret.POVAngle = tmpJoyInfo.dwPOV / 100.0;

			return ret;
		}