Exemple #1
0
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(XnaShooterGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Credits
            int xPos = 50 * BaseGame.Width / 1024;
            int yPos = 260 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos, "Credits");

            WriteCreditsWithLink(xPos, yPos+56, "Idea, Design, Programming",
                "Benjamin Nitschke (abi)",
                "http://abi.exdream.com", game);
            WriteCredits(xPos, yPos + 137, "Thanks fly out to",
                "Leif Griga, Christoph Rienaecker (WAII),");
            WriteCredits(xPos, yPos + 177, "",
                "Boje Holtz, Enrico Cieslik (Judge),");
            WriteCredits(xPos, yPos + 217, "",
                "Kai Walter (for some sound effects),");
            WriteCredits(xPos, yPos + 257, "",
                "ZMan (www.thezbuffer.com),");
            WriteCredits(xPos, yPos + 297, "",
                "Christina Storm, the XNA team");
            WriteCredits(xPos, yPos + 337, "",
                "and the .NET teams of Microsoft.");

            TextureFont.WriteText(BaseGame.XToRes(150), BaseGame.YToRes(687),
                "Dedicated to the great XNA Framework.");

            if (game.RenderMenuButton(MenuButton.Back,
                new Point(1024 - 230, 768 - 150)))
            {
                quit = true;
            } // if
        }
Exemple #2
0
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(XnaShooterGame game)
        {
            if (xInputMenuSelection < 0)
            {
                xInputMenuSelection = 0;
                SelectMenuItemForXInput();
            } // if

            if (resetCamera)
            {
                resetCamera = false;
                XnaShooterGame.camera.SetPosition(Vector3.Zero);
                xInputMenuSelection = 0;
            } // if

            // Render background
            game.RenderMenuBackground();

            // Show all buttons
            int buttonNum = 0;
            MenuButton[] menuButtons = new MenuButton[]
                {
                    MenuButton.Missions,
                    MenuButton.Highscore,
                    MenuButton.Credits,
                    MenuButton.Exit,
                    MenuButton.Back,
                };
            foreach (MenuButton button in menuButtons)
                //EnumHelper.GetEnumerator(typeof(MenuButton)))
                // Don't render the back button
                if (button != MenuButton.Back)
                {
                    if (game.RenderMenuButton(button, buttonLocations[buttonNum]))
                    {
                        if (button == MenuButton.Missions)
                            game.AddGameScreen(new Mission());
                        else if (button == MenuButton.Highscore)
                            game.AddGameScreen(new Highscores());
                        else if (button == MenuButton.Credits)
                            game.AddGameScreen(new Credits());
                        else if (button == MenuButton.Exit)
                            quit = true;
                    } // if
                    buttonNum++;
                    if (buttonNum >= buttonLocations.Length)
                        break;
                } // if

            // Hotkeys, M=Mission, H=Highscores, C=Credits, Esc=Quit
            if (Input.KeyboardKeyJustPressed(Keys.M))
                game.AddGameScreen(new Mission());
            else if (Input.KeyboardKeyJustPressed(Keys.H))
                game.AddGameScreen(new Highscores());
            else if (Input.KeyboardKeyJustPressed(Keys.C))
                game.AddGameScreen(new Credits());
            else if (Input.KeyboardEscapeJustPressed ||
                Input.GamePadBackJustPressed)
                quit = true;

            // If pressing XBox controller up/down change selection
            if (Input.GamePadDownJustPressed ||
                Input.KeyboardDownJustPressed)
            {
                xInputMenuSelection =
                    (xInputMenuSelection + 1) % buttonLocations.Length;
                SelectMenuItemForXInput();
            } // if (Input.GamePad)
            else if (Input.GamePadUpJustPressed ||
                Input.KeyboardUpJustPressed)
            {
                if (xInputMenuSelection <= 0)
                    xInputMenuSelection = buttonLocations.Length;
                xInputMenuSelection--;
                SelectMenuItemForXInput();
            } // if (Input.GamePad)
        }
Exemple #3
0
        /// <summary>
        /// Run game screen. Called each frame.
        /// </summary>
        /// <param name="game">Form for access to asteroid manager and co</param>
        public void Run(XnaShooterGame game)
        {
            // Render background
            game.RenderMenuBackground();

            // Show highscores, allow to select between local highscores,
            // online highscores this hour and online highscores best of all time.
            int xPos = 100 * BaseGame.Width / 1024;
            int yPos = 260 * BaseGame.Height / 768;
            TextureFont.WriteText(xPos, yPos,
                "Highscores:");

            // Local Highscores
            Rectangle rect = new Rectangle(
                xPos + 210 * BaseGame.Width / 1024,
                yPos + 0 * BaseGame.Height / 768, 130, 28);
            bool highlighted = Input.MouseInBox(rect);
            TextureFont.WriteText(rect.X, rect.Y, "Local",
                highscoreMode == HighscoreModes.Local ? Color.Red :
                highlighted ? Color.LightSalmon : Color.White);
            if (highlighted &&
                Input.MouseLeftButtonJustPressed)
                highscoreMode = HighscoreModes.Local;

            yPos = 310 * BaseGame.Height / 768;
            Highscore[] selectedHighscores =
                highscoreMode == HighscoreModes.Local ?
                highscores : onlineHighscores;

            for (int num = 0; num < NumOfHighscores; num++)
            {
                Color col = Input.MouseInBox(new Rectangle(
                    xPos, yPos + num * 30, 600 + 200, 28)) ?
                    Color.White : ColorHelper.FromArgb(200, 200, 200);
                TextureFont.WriteText(xPos, yPos + num * 29,
                    (1 + num) + ".", col);
                TextureFont.WriteText(xPos + 50, yPos + num * 30,
                    selectedHighscores[num].name, col);
                TextureFont.WriteText(xPos + 340, yPos + num * 30,
                    "Score: " + selectedHighscores[num].points, col);
                TextureFont.WriteText(xPos + 610, yPos + num * 30,
                    "Mission: " + selectedHighscores[num].level, col);
            } // for (num)

            if (game.RenderMenuButton(MenuButton.Back,
                new Point(1024 - 230, 768 - 150)))
            {
                quit = true;
            } // if
        }