Ejemplo n.º 1
0
        public void Update()
        {
            GamePadState  newPadState = GamePad.GetState(PlayerIndex.One);
            KeyboardState newKeyState = Keyboard.GetState();

            if (game.keyJustPressed(lastKeyState, newKeyState, Keys.Up) || game.padJustPressed(lastPadState, newPadState, Buttons.DPadUp))
            {
                currentIndices[currentLetter]++;
                if (currentIndices[currentLetter] > (int)'Z')
                {
                    currentIndices[currentLetter] = (int)'A';
                }
            }

            if (game.keyJustPressed(lastKeyState, newKeyState, Keys.Down) || game.padJustPressed(lastPadState, newPadState, Buttons.DPadDown))
            {
                currentIndices[currentLetter]--;
                if (currentIndices[currentLetter] < (int)'A')
                {
                    currentIndices[currentLetter] = (int)'Z';
                }
            }

            if (game.keyJustPressed(lastKeyState, newKeyState, Keys.Right) || game.padJustPressed(lastPadState, newPadState, Buttons.DPadRight))
            {
                currentLetter++;
                if (currentLetter > (currentIndices.Length - 1))
                {
                    currentLetter = 0;
                }
            }

            if (game.keyJustPressed(lastKeyState, newKeyState, Keys.Left) || game.padJustPressed(lastPadState, newPadState, Buttons.DPadLeft))
            {
                currentLetter--;
                if (currentLetter < 0)
                {
                    currentLetter = (currentIndices.Length - 1);
                }
            }

            if (game.keyJustReleased(lastKeyState, newKeyState, Keys.Enter) || game.padJustReleased(lastPadState, newPadState, Buttons.A))
            {
                game.appendLeaderboard();
                game.setMode(game.LEADERBOARD);
            }

            lastPadState = newPadState;
            lastKeyState = newKeyState;

            updateOutput();
        }