示例#1
0
        /// <summary> Input.GetKeyUp for the specific controller button. </summary>
        /// <param name="button"> The specific controller button. </param>
        /// <returns> True if that button has been released. </returns>
        private bool GetButtonUp(string button, int playerNumber)
        {
            switch (button)
            {
            case A: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.A, playerNumber));

            case B: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.B, playerNumber));

            case X: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.X, playerNumber));

            case Y: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.Y, playerNumber));

            case RB: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.RightBumper, playerNumber));

            case LB: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.LeftBumper, playerNumber));

            case START: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.Start, playerNumber));

            case BACK: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.Back, playerNumber));

            case LEFT_STICK: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.LeftStickClick, playerNumber));

            default: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.RightStickClick, playerNumber));
            }
        }
示例#2
0
        /// <summary> Updates all the values for a specific input based on a controller. </summary>
        /// <param name="input"> The input to update. </param>
        private void updatePad(int input, int playerNumber)
        {
            switch (gamePad[input, playerNumber])
            {
            case LEFT_STICK_RIGHT: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.LeftStickX, playerNumber), playerNumber); break;

            case LEFT_STICK_LEFT: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.LeftStickX, playerNumber), playerNumber); break;

            case LEFT_STICK_UP: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.LeftStickY, playerNumber), playerNumber); break;

            case LEFT_STICK_DOWN: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.LeftStickY, playerNumber), playerNumber); break;

            case RIGHT_STICK_RIGHT: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.RightStickX, playerNumber), playerNumber); break;

            case RIGHT_STICK_LEFT: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.RightStickX, playerNumber), playerNumber); break;

            case RIGHT_STICK_UP: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.RightStickY, playerNumber), playerNumber); break;

            case RIGHT_STICK_DOWN: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.RightStickY, playerNumber), playerNumber); break;

            case DPAD_RIGHT: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.DPadX, playerNumber), playerNumber); break;

            case DPAD_LEFT: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.DPadX, playerNumber), playerNumber); break;

            case DPAD_UP: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.DPadY, playerNumber), playerNumber); break;

            case DPAD_DOWN: UpdateAxis(input, ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.DPadY, playerNumber), playerNumber); break;

            case LEFT_TRIGGER: UpdateAxis(input, ControllerInputHandler.GetTrigger(ControllerInputHandler.Triggers.LeftTrigger, playerNumber), playerNumber); break;

            case RIGHT_TRIGGER: UpdateAxis(input, ControllerInputHandler.GetTrigger(ControllerInputHandler.Triggers.RightTrigger, playerNumber), playerNumber); break;

            default: UpdateButton(input, playerNumber); break;
            }
        }
示例#3
0
        /// <summary> Input.GetKeyUp for the specific controller button. </summary>
        /// <param name="button"> The specific controller button. </param>
        /// <returns> True if that button has been released. </returns>
        private bool GetButtonUp(string button)
        {
            switch (button)
            {
            case A: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.A));

            case B: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.B));

            case X: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.X));

            case Y: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.Y));

            case RB: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.RightBumper));

            case LB: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.LeftBumper));

            case START: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.Start));

            case BACK: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.Back));

            case LEFT_STICK: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.LeftStickClick));

            default: return(ControllerInputHandler.GetButtonUp(ControllerInputHandler.Buttons.RightStickClick));
            }
        }
示例#4
0
 /// <summary> Used to see if the user hit any button on the controller. </summary>
 /// <returns> True if the user hit any input on the controller. </returns>
 public static bool AnyPadInput()
 {
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.LeftStickX) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.LeftStickY) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.RightStickX) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.RightStickY) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.DPadX) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.DPadY) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetTrigger(ControllerInputHandler.Triggers.LeftTrigger) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetTrigger(ControllerInputHandler.Triggers.RightTrigger) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.A))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.B))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.X))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.Y))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.LeftBumper))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.RightBumper))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.Back))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.Start))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.LeftStickClick))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.RightStickClick))
     {
         return(true);
     }
     return(false);
 }
示例#5
0
 /// <summary> Used to see if the user hit any button on the controller. </summary>
 /// <returns> True if the user hit any input on the controller. </returns>
 public static bool AnyPadInput()
 {
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.LeftStickX, gamePadMapping[0]) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.LeftStickY, gamePadMapping[0]) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.RightStickX, gamePadMapping[0]) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.RightStickY, gamePadMapping[0]) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.DPadX, gamePadMapping[0]) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetAxis(ControllerInputHandler.Axis.DPadY, gamePadMapping[0]) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetTrigger(ControllerInputHandler.Triggers.LeftTrigger, gamePadMapping[0]) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetTrigger(ControllerInputHandler.Triggers.RightTrigger, gamePadMapping[0]) != 0)
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.A, gamePadMapping[0]))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.B, gamePadMapping[0]))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.X, gamePadMapping[0]))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.Y, gamePadMapping[0]))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.LeftBumper, gamePadMapping[0]))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.RightBumper, gamePadMapping[0]))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.Back, gamePadMapping[0]))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.Start, gamePadMapping[0]))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.LeftStickClick, gamePadMapping[0]))
     {
         return(true);
     }
     if (ControllerInputHandler.GetButton(ControllerInputHandler.Buttons.RightStickClick, gamePadMapping[0]))
     {
         return(true);
     }
     return(false);
 }
示例#6
0
 protected override void InitInput()
 {
     //add the input helper for menus
     var input = new ControllerInputHandler(this);
 }