コード例 #1
0
 public override void Update(GameTime gameTime)
 {
     BananaGame.GamePlayer.Update(gameTime);
     if (GameKeyState.IsKeyPressed(Keys.U))
     {
         //GameMouseState.WP();
         Vector2Int blah = new Vector2Int(GameMouseState.WorldPosition());
         highlight = new TileHighlight(blah.asVector2(), Color.Blue);
     }
 }
コード例 #2
0
ファイル: KeyboardInput.cs プロジェクト: jwoschitz/Lava
 public bool IsKeyState(GameKeyState key)
 {
     switch (key)
     {
         case GameKeyState.Forward:
             return KeyState.IsKeyDown(Keys.Up) || KeyState.IsKeyDown(Keys.W);
         case GameKeyState.Backward:
             return KeyState.IsKeyDown(Keys.Down) || KeyState.IsKeyDown(Keys.S);
         case GameKeyState.Right:
             return KeyState.IsKeyDown(Keys.Right) || KeyState.IsKeyDown(Keys.D);
         case GameKeyState.Left:
             return KeyState.IsKeyDown(Keys.Left) || KeyState.IsKeyDown(Keys.A);
         case GameKeyState.ToggleCamera:
             return isNewKeyPress(Keys.C);
         case GameKeyState.ToggleScreen:
             return isNewKeyPress(Keys.V);
         default:
             return false;
     }
 }
コード例 #3
0
ファイル: GameDebugger.cs プロジェクト: tyy996/BananaGame
        private static void debugInputUpdate()
        {
            if (GameKeyState.IsKeyPressed(Keys.F3))
            {
                if ((int)DrawState == Enum.GetValues(typeof(DebugDrawState)).Length)
                {
                    DrawState = DebugDrawState.None;
                }
                else
                {
                    DrawState++;
                }
            }

            if (GameKeyState.IsKeyPressed(Keys.F4))
            {
                IsChunkBoundsDrawn = !IsChunkBoundsDrawn;
            }

            if (GameKeyState.IsKeyPressed(Keys.F12))
            {
                DebugStopTrigger = !DebugStopTrigger;
            }
        }
コード例 #4
0
ファイル: InputHandler.cs プロジェクト: zougames/ZouBaseXNA
 /// <summary>
 /// Checa o estado da tecla e dispara os eventos.
 /// </summary>
 /// <param name="key">Tecla</param>
 /// <param name="prevState">Estado anterior</param>
 /// <param name="currState">Estado corrente</param>
 private void checkKeyState(GameKeys key, GameKeyState prevState, GameKeyState currState)
 {
     //Se o estado anterior era Released e o estado corrente é Pressed
     // dispara os dois eventos de Pressed e IsDown.
     if (prevState == GameKeyState.Released && currState == GameKeyState.Pressed)
     {
         handleGameKeyPressed(key);
         handleGameKeyIsDown(key);
     }
     // Se o estado anterior era pressed e o estado corrente é Released
     // dispara o evento Released.
     if (prevState == GameKeyState.Pressed && currState == GameKeyState.Released)
         handleGameKeyReleased(key);
     //Se o estado anterior é pressed e o corrente é pressed
     // dispara o evento Pressed.
     if (prevState == GameKeyState.Pressed && currState == GameKeyState.Pressed)
         handleGameKeyIsDown(key);
 }
コード例 #5
0
ファイル: InputHandler.cs プロジェクト: zougames/ZouBaseXNA
        public GameKeysState(GameKeyState A,
                             GameKeyState B,
                             GameKeyState X,
                             GameKeyState Y,
                             GameKeyState L1,
                             GameKeyState L2,
                             GameKeyState R1,
                             GameKeyState R2,
                             GameKeyState Start,
                             GameKeyState Back,
                             GameKeyState Up,
                             GameKeyState Down,
                             GameKeyState Left,
                             GameKeyState Right,
                             GameKeyState UpLeft,
                             GameKeyState UpRight,
                             GameKeyState DownLeft,
                             GameKeyState DownRight,
                             GameKeyState NoneDirection,
                             GameKeyState T2Up,
                             GameKeyState T2Down,
                             GameKeyState T2Left,
                             GameKeyState T2Right,
                             GameKeyState T2UpLeft,
                             GameKeyState T2UpRight,
                             GameKeyState T2DownLeft,
                             GameKeyState T2DownRight,
                             GameKeyState T2NoneDirection,
                             GameKeyState LeftStick,
                             GameKeyState RightStick)
        {
            this.A = A;
            this.B = B;
            this.X = X;
            this.Y = Y;

            this.L1 = L1;
            this.L2 = L2;
            this.R1 = R1;
            this.R2 = R2;

            this.LeftStick = LeftStick;
            this.RightStick = RightStick;

            this.Start = Start;
            this.Back = Back;
            this.Up = Up;
            this.Down = Down;
            this.Left = Left;
            this.Right = Right;

            this.UpLeft = UpLeft;
            this.UpRight = UpRight;
            this.DownRight = DownRight;
            this.DownLeft = DownLeft;

            this.NoneDirection = NoneDirection;

            this.T2Up = T2Up;
            this.T2Down = T2Down;
            this.T2Left = T2Left;
            this.T2Right = T2Right;

            this.T2UpLeft = T2UpLeft;
            this.T2UpRight = T2UpRight;
            this.T2DownRight = T2DownRight;
            this.T2DownLeft = T2DownLeft;

            this.T2NoneDirection = T2NoneDirection;
        }