コード例 #1
0
 public JoystickPOVChangedEvent(InputDevice device, JoystickInputDevice.POV pov)
     : base(device)
 {
     this.pov = pov;
 }
コード例 #2
0
        internal bool Init()
        {
            //buttons
            Button[] buttons = new Button[10];
            buttons[0] = new Button(JoystickButtons.XBox360_A, 0);
            buttons[1] = new Button(JoystickButtons.XBox360_B, 1);
            buttons[2] = new Button(JoystickButtons.XBox360_X, 2);
            buttons[3] = new Button(JoystickButtons.XBox360_Y, 3);
            buttons[4] = new Button(JoystickButtons.XBox360_LeftShoulder, 4);
            buttons[5] = new Button(JoystickButtons.XBox360_RightShoulder, 5);
            buttons[6] = new Button(JoystickButtons.XBox360_Back, 6);
            buttons[7] = new Button(JoystickButtons.XBox360_Start, 7);
            buttons[8] = new Button(JoystickButtons.XBox360_LeftThumbstick, 8);
            buttons[9] = new Button(JoystickButtons.XBox360_RightThumbstick, 9);

            //axes
            Axis[] axes = new Axis[6];

            for (int n = 0; n < 6; n++)
            {
                JoystickInputDevice.Axis axis = null;

                switch (n)
                {
                case 0:                 // left thumb x
                    axis = new JoystickInputDevice.Axis(
                        JoystickAxes.XBox360_LeftThumbstickX, new RangeF(-1, 1), false);
                    break;

                case 1:                 // left thumb y
                    axis = new JoystickInputDevice.Axis(
                        JoystickAxes.XBox360_LeftThumbstickY, new RangeF(-1, 1), false);
                    break;

                case 2:                 // right thumb x
                    axis = new JoystickInputDevice.Axis(
                        JoystickAxes.XBox360_RightThumbstickX, new RangeF(-1, 1), false);
                    break;

                case 3:                 // right thumb y
                    axis = new JoystickInputDevice.Axis(
                        JoystickAxes.XBox360_RightThumbstickY, new RangeF(-1, 1), false);
                    break;

                case 4:                 // left trigger
                    axis = new JoystickInputDevice.Axis(
                        JoystickAxes.XBox360_LeftTrigger, new RangeF(0, 1), false);
                    break;

                case 5:                 // right trigger
                    axis = new JoystickInputDevice.Axis(
                        JoystickAxes.XBox360_RightTrigger, new RangeF(0, 1), false);
                    break;
                }

                axes[n] = axis;
            }

            //povs
            POV[] povs = new POV[1];
            povs[0] = new JoystickInputDevice.POV(JoystickPOVs.POV1);

            //sliders
            Slider[] sliders = new Slider[0];

            //forceFeedbackController
            WindowsXBoxForceFeedbackController forceFeedbackController =
                new WindowsXBoxForceFeedbackController(this);

            //initialize data
            InitDeviceData(buttons, axes, povs, sliders, forceFeedbackController);

            return(true);
        }