コード例 #1
0
    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.Black);

        spriteBatch.Begin();

        switch (currentMode)
        {
        case MODE.GAME: game.Draw(gameTime, spriteBatch); break;

        case MODE.WELCOME: welcomeScr.Draw(gameTime, spriteBatch); break;

        case MODE.LOADING: loadingScr.Draw(gameTime, spriteBatch); break;

        case MODE.CREDITS: creditsScr.Draw(gameTime, spriteBatch); break;

        case MODE.CONFIG: configScr.Draw(gameTime, spriteBatch); break;

        case MODE.HELP: helpScr.Draw(gameTime, spriteBatch); break;

        case MODE.END: endScr.Draw(gameTime, spriteBatch); break;
        }

        spriteBatch.End();
        base.Draw(gameTime);
    }
コード例 #2
0
ファイル: Game1.cs プロジェクト: ArizonaIcedOut/RapidFire
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);

            // TODO: Add your drawing code here

            spriteBatch.Begin();

            switch (Globals.Gamestate)
            {
            case Globals.LOGO:
            {
                // Draws the logo
                spriteBatch.Draw(logoImg, new Rectangle(300, 360, 600, 80), Color.White);
                break;
            }

            case Globals.MENU:
            {
                Menu.Draw(spriteBatch, gameTime);
                break;
            }

            case Globals.TRANSITION:
            {
                TransitionScreen.Draw(spriteBatch);
                break;
            }

            case Globals.GAMEPLAY:
            {
                // Draws the assets of the appropriate game
                switch (Globals.Minigame)
                {
                case Globals.LUCKY_DAY:
                {
                    luckyDay.Draw(spriteBatch, gameTime);
                    break;
                }

                case Globals.COLOR_GUESSER:
                {
                    colorGuesser.Draw(spriteBatch);
                    break;
                }

                case Globals.RAINDROPS:
                {
                    raindrops.Draw(spriteBatch, gameTime);
                    break;
                }

                case Globals.JUGGLER:
                {
                    juggler.Draw(spriteBatch, gameTime);
                    break;
                }

                case Globals.TERMINAL_VELOCITY:
                {
                    terminalVelocity.Draw(spriteBatch, gameTime);
                    break;
                }

                case Globals.BACKWARDS:
                {
                    backwards.Draw(spriteBatch);
                    break;
                }

                case Globals.TYPEWRITER:
                {
                    typewriter.Draw(spriteBatch);
                    break;
                }

                case Globals.FLOOR_IS_LAVA:
                {
                    floorIsLava.Draw(spriteBatch, gameTime);
                    break;
                }

                case Globals.MILKSHAKER:
                {
                    milkshaker.Draw(spriteBatch);
                    break;
                }

                case Globals.CIRCLE_CLICKER:
                {
                    circleClicker.Draw(spriteBatch);
                    break;
                }
                }

                // Draws the hud elements
                Hud.Draw(spriteBatch);
                break;
            }

            case Globals.RESULTS:
            {
                Results.Draw(spriteBatch);
                break;
            }

            case Globals.LEADERBOARD:
            {
                Leaderboard.Draw(spriteBatch);
                break;
            }
            }

            // Draws the help screen if it is open
            if (Globals.HelpScreenOpen && !Globals.Fade.Active)
            {
                HelpScreen.Draw(spriteBatch);
            }

            // Draws the pause screen if it is active
            if (paused)
            {
                spriteBatch.Draw(blankRecImg, Globals.GetRec(), Color.Black * pausedOpacity);
                spriteBatch.DrawString(bigFont, "PAUSED", Globals.CentreText(Globals.GetRec(), "PAUSED", bigFont), Color.White);

                spriteBatch.Draw(menuBtn.Img, menuBtn.Rec, Color.White);
            }

            // Draws the fade if it is active
            if (Globals.Fade.Active)
            {
                Globals.Fade.Draw(spriteBatch);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }