Example #1
0
        public bool ButtonDown(ZuneButtons Button)
        {
            switch (Button)
            {
            case ZuneButtons.Up:
            {
                return(GamePad.ButtonDown(Buttons.DPadDown));
            }

            case ZuneButtons.Down:
            {
                return(GamePad.ButtonDown(Buttons.DPadDown));
            }

            case ZuneButtons.Right:
            {
                return(GamePad.ButtonDown(Buttons.DPadRight));
            }

            case ZuneButtons.Left:
            {
                return(GamePad.ButtonDown(Buttons.DPadLeft));
            }

            case ZuneButtons.Start:
            {
                return(GamePad.ButtonDown(Buttons.B));
            }

            case ZuneButtons.Back:
            {
                return(GamePad.ButtonDown(Buttons.Back));
            }

            case ZuneButtons.TouchCenter:
            {
                return(GamePad.ButtonDown(Buttons.LeftStick));
            }

            case ZuneButtons.PressCenter:
            {
                return(GamePad.ButtonDown(Buttons.LeftShoulder));
            }
            }

            return(false);
        }
Example #2
0
 /// <summary>
 /// If the specified button is not pressed
 /// </summary>
 /// <param name="button">The button to check</param>
 /// <returns></returns>
 public static bool IsButtonUp(ZuneButtons button)
 {
     return GamePad.GetState(PlayerIndex.One).IsButtonUp((Buttons)button);
 }
Example #3
0
 /// <summary>
 /// If the specified button is not pressed
 /// </summary>
 /// <param name="button">The button to check</param>
 /// <returns></returns>
 public static bool IsButtonUp(ZuneButtons button)
 {
     return(GamePad.GetState(PlayerIndex.One).IsButtonUp((Buttons)button));
 }
 /// <summary>
 /// Initializes a new instance of the ZuneButtonEventArgs class.
 /// </summary>
 /// <param name="button">The ZuneButton associated with this event</param>
 /// <param name="gameTime">The GameTime given when an Update() call generated the event</param>
 public ZuneButtonEventArgs(ZuneButtons button, GameTime gameTime)
 {
     this.button = button;
     this.gameTime = gameTime;
 }
        private Buttons ButtonFromZuneButton(ZuneButtons zBtn)
        {
            switch (zBtn)
            {
                case ZuneButtons.Up:
                    if (orientation == ZuneOrientations.Portrait)
                        return Buttons.DPadUp;
                    else if (orientation == ZuneOrientations.Landscape)
                        return Buttons.DPadRight;
                    else
                        return Buttons.DPadLeft;

                case ZuneButtons.Down:
                    if (orientation == ZuneOrientations.Portrait)
                        return Buttons.DPadDown;
                    else if (orientation == ZuneOrientations.Landscape)
                        return Buttons.DPadLeft;
                    else
                        return Buttons.DPadRight;

                case ZuneButtons.Left:
                    if (orientation == ZuneOrientations.Portrait)
                        return Buttons.DPadLeft;
                    else if (orientation == ZuneOrientations.Landscape)
                        return Buttons.DPadUp;
                    else
                        return Buttons.DPadDown;

                case ZuneButtons.Right:
                    if (orientation == ZuneOrientations.Portrait)
                        return Buttons.DPadRight;
                    else if (orientation == ZuneOrientations.Landscape)
                        return Buttons.DPadDown;
                    else
                        return Buttons.DPadUp;

                case ZuneButtons.Select:
                    return Buttons.A;

                case ZuneButtons.Back:
                    return Buttons.Back;

                case ZuneButtons.PlayPause:
                    return Buttons.B;

                default:
                    throw new ArgumentException("zBtn was not one of the values in ZuneButtons", "zBtn");
            }
        }
 public bool IsPressed(ZuneButtons zuneButton)
 {
     Buttons b = ButtonFromZuneButton(zuneButton);
     return state1.IsButtonDown(b);
 }
 public bool IsNewPress(ZuneButtons zuneButton)
 {
     Buttons b = ButtonFromZuneButton(zuneButton);
     bool down1 = state1.IsButtonDown(b);
     bool down2 = state2.IsButtonDown(b);
     return ((down1 != down2) && down1);
 }