コード例 #1
0
ファイル: XZuneInput.cs プロジェクト: bondjames12/spheregame
        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);
        }
コード例 #2
0
ファイル: GameInput.cs プロジェクト: fourplus/AStar-Learner
 /// <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);
 }
コード例 #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));
 }
コード例 #4
0
 /// <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;
 }
コード例 #5
0
        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");
            }
        }
コード例 #6
0
 public bool IsPressed(ZuneButtons zuneButton)
 {
     Buttons b = ButtonFromZuneButton(zuneButton);
     return state1.IsButtonDown(b);
 }
コード例 #7
0
 public bool IsNewPress(ZuneButtons zuneButton)
 {
     Buttons b = ButtonFromZuneButton(zuneButton);
     bool down1 = state1.IsButtonDown(b);
     bool down2 = state2.IsButtonDown(b);
     return ((down1 != down2) && down1);
 }