コード例 #1
0
        private static void HandleInput(GameLogic gameLogic, float time)
        {
            float axisUpDown    = Keyboard.GetState()[Key.Up] ? -1.0f : Keyboard.GetState()[Key.Down] ? 1.0f : 0.0f;
            float axisLeftRight = Keyboard.GetState()[Key.Left] ? -1.0f : Keyboard.GetState()[Key.Right] ? 1.0f : 0.0f;
            bool  shoot         = Keyboard.GetState()[Key.Space];

            gameLogic.Update(time, axisUpDown, axisLeftRight, shoot);
        }
コード例 #2
0
        private static void HandleInput(IInput input, GameLogic gameLogic, float time)
        {
            float axisLeftRight = input.IsButtonDown("Left") ? -1.0f : input.IsButtonDown("Right") ? 1.0f : 0.0f;
            float axisUpDown    = input.IsButtonDown("Down") ? -1.0f : input.IsButtonDown("Up") ? 1.0f : 0.0f;
            bool  shoot         = input.IsButtonDown("Space");

            gameLogic.Update(time, axisUpDown, axisLeftRight, shoot);
        }