Exemplo n.º 1
0
        public ControllerXbox360(params int[] joystickId)
        {
            AddButton(Controls.A);
            AddButton(Controls.B);
            AddButton(Controls.X);
            AddButton(Controls.Y);
            AddButton(Controls.RB);
            AddButton(Controls.LB);
            AddButton(Controls.LStickClick);
            AddButton(Controls.RStickClick);
            AddButton(Controls.Start);
            AddButton(Controls.Back);
            AddButton(Controls.RT);
            AddButton(Controls.LT);
            AddButton(Controls.Up);
            AddButton(Controls.Down);
            AddButton(Controls.Left);
            AddButton(Controls.Right);

            AddAxis(Controls.LStick);
            AddAxis(Controls.RStick);
            AddAxis(Controls.DPad);
            AddAxis(Controls.Triggers);

            foreach (var joy in joystickId)
            {
                A.AddJoyButton(0, joy);
                B.AddJoyButton(1, joy);
                X.AddJoyButton(2, joy);
                Y.AddJoyButton(3, joy);
                LB.AddJoyButton(4, joy);
                RB.AddJoyButton(5, joy);
                Back.AddJoyButton(6, joy);
                Start.AddJoyButton(7, joy);
                LeftStickClick.AddJoyButton(8, joy);
                RightStickClick.AddJoyButton(9, joy);

                RT.AddAxisButton(AxisButton.ZMinus, joy);
                LT.AddAxisButton(AxisButton.ZPlus, joy);

                LeftStick.AddJoyAxis(JoyAxis.X, JoyAxis.Y, joy);
                RightStick.AddJoyAxis(JoyAxis.U, JoyAxis.R, joy);
                DPad.AddJoyAxis(JoyAxis.PovX, JoyAxis.PovY, joy);
                Triggers.AddJoyAxis(JoyAxis.Z, JoyAxis.Z, joy);

                Up
                .AddAxisButton(AxisButton.YMinus, joy)
                .AddAxisButton(AxisButton.PovYMinus, joy);
                Down
                .AddAxisButton(AxisButton.YPlus, joy)
                .AddAxisButton(AxisButton.PovYPlus, joy);
                Right
                .AddAxisButton(AxisButton.XPlus, joy)
                .AddAxisButton(AxisButton.PovXPlus, joy);
                Left
                .AddAxisButton(AxisButton.XMinus, joy)
                .AddAxisButton(AxisButton.PovXMinus, joy);
            }
        }