// process input
        public override void ProcessInput(float elapsedTime, InputManager input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            int i, j = (int)gameManager.GameMode;

            for (i = 0; i < j; i++)
            {
                // Any key/button to go back
                if (input.IsButtonPressedA(i) ||
                    input.IsButtonPressedB(i) ||
                    input.IsButtonPressedX(i) ||
                    input.IsButtonPressedY(i) ||
                    input.IsButtonPressedLeftShoulder(i) ||
                    input.IsButtonPressedRightShoulder(i) ||
                    input.IsButtonPressedLeftStick(i) ||
                    input.IsButtonPressedRightStick(i) ||
                    input.IsButtonPressedBack(i) ||
                    input.IsButtonPressedStart(i) ||
                    input.IsKeyPressed(i, Keys.Enter) ||
                    input.IsKeyPressed(i, Keys.Escape) ||
                    input.IsKeyPressed(i, Keys.Space))
                {
                    screenManager.SetNextScreen(ScreenType.ScreenIntro);
                    gameManager.PlaySound("menu_cancel");
                }
            }
        }
Exemple #2
0
        // process input
        public override void ProcessInput(float elapsedTime, InputManager input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            for (int i = 0; i < 2; i++)
            {
                // A button or enter to select menu option
                if (input.IsButtonPressedA(i) ||
                    input.IsButtonPressedStart(i) ||
                    input.IsKeyPressed(i, Keys.Enter) ||
                    input.IsKeyPressed(i, Keys.Space))
                {
                    switch (menuSelection)
                    {
                    case 0:
                        // single player
                        gameManager.GameMode = GameMode.SinglePlayer;
                        screenManager.SetNextScreen(ScreenType.ScreenPlayer);
                        break;

                    case 1:
                        // multi player
                        gameManager.GameMode = GameMode.MultiPlayer;
                        screenManager.SetNextScreen(ScreenType.ScreenPlayer);
                        break;

                    case 2:
                        // help
                        screenManager.SetNextScreen(ScreenType.ScreenHelp);
                        break;

                    case 3:
                        // exit game
                        screenManager.Exit();
                        break;
                    }
                    gameManager.PlaySound("menu_select");
                }

                // up/down keys change menu sel
                if (input.IsKeyPressed(i, Keys.Up) ||
                    input.IsButtonPressedDPadUp(i) ||
                    input.IsButtonPressedLeftStickUp(i))
                {
                    menuSelection =
                        (menuSelection == 0 ? NumberMenuItems - 1 : menuSelection - 1);
                    gameManager.PlaySound("menu_change");
                }
                if (input.IsKeyPressed(i, Keys.Down) ||
                    input.IsButtonPressedDPadDown(i) ||
                    input.IsButtonPressedLeftStickDown(i))
                {
                    menuSelection = (menuSelection + 1) % NumberMenuItems;
                    gameManager.PlaySound("menu_change");
                }
            }
        }
Exemple #3
0
        // process input
        public override void ProcessInput(float elapsedTime, InputManager input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            int i, j = (int)gameManager.GameMode;
            for (i = 0; i < j; i++)
            {
                // Any key/button to go back
                if (input.IsButtonPressedA(i) ||
                    input.IsButtonPressedB(i) ||
                    input.IsButtonPressedX(i) ||
                    input.IsButtonPressedY(i) ||
                    input.IsButtonPressedLeftShoulder(i) ||
                    input.IsButtonPressedRightShoulder(i) ||
                    input.IsButtonPressedLeftStick(i) ||
                    input.IsButtonPressedRightStick(i) ||
                    input.IsButtonPressedBack(i) ||
                    input.IsButtonPressedStart(i) ||
                    input.IsKeyPressed(i, Keys.Enter) ||
                    input.IsKeyPressed(i, Keys.Escape) ||
                    input.IsKeyPressed(i, Keys.Space))
                {
                    screenManager.SetNextScreen(ScreenType.ScreenIntro);
                    gameManager.PlaySound("menu_cancel");
                }
            }
        }
Exemple #4
0
        // process input
        public override void ProcessInput(float elapsedTime, InputManager input)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            for (int i = 0; i < 2; i++)
            {
                // A button or enter to select menu option
                if (input.IsButtonPressedA(i) ||
                    input.IsButtonPressedStart(i) ||
                    input.IsKeyPressed(i, Keys.Enter) ||
                    input.IsKeyPressed(i, Keys.Space))
                {
                    switch (menuSelection)
                    {
                        case 0:
                            // single player
                            gameManager.GameMode = GameMode.SinglePlayer;
                            screenManager.SetNextScreen(ScreenType.ScreenPlayer);
                            break;
                        case 1:
                            // multi player
                            gameManager.GameMode = GameMode.MultiPlayer;
                            screenManager.SetNextScreen(ScreenType.ScreenPlayer);
                            break;
                        case 2:
                            // help
                            screenManager.SetNextScreen(ScreenType.ScreenHelp);
                            break;
                        case 3:
                            // exit game
                            screenManager.Exit();
                            break;
                    }
                    gameManager.PlaySound("menu_select");
                }

                // up/down keys change menu sel
                if (input.IsKeyPressed(i,Keys.Up) ||
                    input.IsButtonPressedDPadUp(i) ||
                    input.IsButtonPressedLeftStickUp(i))
                {
                    menuSelection =
                        (menuSelection == 0 ? NumberMenuItems - 1 : menuSelection - 1);
                    gameManager.PlaySound("menu_change");
                }
                if (input.IsKeyPressed(i, Keys.Down) ||
                    input.IsButtonPressedDPadDown(i) ||
                    input.IsButtonPressedLeftStickDown(i))
                {
                    menuSelection = (menuSelection + 1) % NumberMenuItems;
                    gameManager.PlaySound("menu_change");
                }
            }
        }