Пример #1
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Read the keypresses
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public void UpdateInput(GameTime gameTime, Camera camera)
        {
            currentDirection = LevelLibrary.Directions.none;
            jumpKeyPressed = false;
            KeyboardState newState = Keyboard.GetState();

            camera.Update(gameTime, newState, oldState);

            // Is the Q key down?
            if (newState.IsKeyDown(jumpKeyMapping))
            {
                jumpKeyPressed = true;
            }
            else if (newState.IsKeyDown(leftKeyMapping))
            {
                currentDirection = LevelLibrary.Directions.left;
            }
            else if (newState.IsKeyDown(rightKeyMapping))
            {
                currentDirection = LevelLibrary.Directions.right;
            }
            else if (newState.IsKeyDown(exitKeyMapping))
            {
                exitKeyPressed = true;
            }
            else if (newState.IsKeyDown(fullKeyMapping))
            {
                fullScreenPressed = true;
            }

            // Update saved state.
            oldState = newState;
        }