示例#1
0
 public XboxController(int player)
 {
     joystick = Sdl.SDL_JoystickOpen(player);
     LeftControlStick = new ControlStick(joystick, 0, 1);
     RightControlStick = new ControlStick(joystick, 4, 3);
     ButtonA = new ControllerButton(joystick, 0);
     ButtonB = new ControllerButton(joystick, 1);
     ButtonX = new ControllerButton(joystick, 2);
     ButtonY = new ControllerButton(joystick, 3);
     ButtonLB = new ControllerButton(joystick, 4);
     ButtonRB = new ControllerButton(joystick, 5);
     ButtonBack = new ControllerButton(joystick, 6);
     ButtonStart = new ControllerButton(joystick, 7);
     ButtonL3 = new ControllerButton(joystick, 8);
     ButtonR3 = new ControllerButton(joystick, 9);
     RightTrigger = new ControlTrigger(joystick, 2, false);
     LeftTrigger = new ControlTrigger(joystick, 2, true);
     Dpad = new DPad(joystick, 0);
 }
示例#2
0
        public XboxController(int player)
        {
            _joystick         = Sdl.SDL_JoystickOpen(player);
            Dpad              = new DPad(_joystick, 0);
            LeftControlStick  = new ControlStick(_joystick, 0, 1);
            RightControlStick = new ControlStick(_joystick, 4, 3);

            ButtonA     = new ControllerButton(_joystick, 0);
            ButtonB     = new ControllerButton(_joystick, 1);
            ButtonX     = new ControllerButton(_joystick, 2);
            ButtonY     = new ControllerButton(_joystick, 3);
            ButtonLB    = new ControllerButton(_joystick, 4);
            ButtonRB    = new ControllerButton(_joystick, 5);
            ButtonBack  = new ControllerButton(_joystick, 6);
            ButtonStart = new ControllerButton(_joystick, 7);
            ButtonL3    = new ControllerButton(_joystick, 8);
            ButtonR3    = new ControllerButton(_joystick, 9);

            RightTrigger = new ControlTrigger(_joystick, 2, false);
            LeftTrigger  = new ControlTrigger(_joystick, 2, true);
        }