Beispiel #1
0
        /// <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)
        {
            float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            this.DisplayInGame();
            FMODUtil.Update();

            //Used to render things to a buffer that will have a zoom multiplier applied before rendering.
            this.GraphicsDevice.Clear(Color.Black);

            if (Game1.SplashDone)
            {
                if (World.Dimensions.Count > 0)
                {
                    //Never set this to SpriteSortMode.Texture, as that causes bugs.
                    this.MapSpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend,
                                              null, null, null, null, RenderInfo.Camera2D.TranslationMatrix);

                    RenderingPipe.DrawScreen(this.MapSpriteBatch);
                    this.MapSpriteBatch.End();
                }

                this.GUIBatch.Begin();
                RenderingPipe.DrawGUI(this.GUIBatch);
                this.GUIBatch.End();
            }
            else
            {
                int length = Game1.SplashScreens.Count;
                for (int i = 0; i < length; i++)
                {
                    LogoScreen item = Game1.SplashScreens[i];
                    if (!item.Done())
                    {
                        item.Draw(this.MapSpriteBatch);
                        break;
                    }

                    if (i == length - 1)
                    {
                        Game1.SplashDone = true;

                        //Initialize main menu
                        GUI.MainMenu.MainMenu.Initialize();
                        this.IsMouseVisible = true;
                    }
                }
            }
            base.Draw(gameTime);
        }
Beispiel #2
0
        /// <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)
        {
            float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            FPS.Update(deltaTime);

            this.DisplayInGame();
            FMODUtil.Update();

            //Used to render things to a buffer that will have a zoom multiplier applied before rendering.

            using (SpriteBatch zoomBatch = new SpriteBatch(this.GraphicsDevice))
            {
                using (RenderTarget2D target = new RenderTarget2D(this.GraphicsDevice, RenderInfo.FullScreenWindow.Width, RenderInfo.FullScreenWindow.Height))
                {
                    this.GraphicsDevice.SetRenderTarget(target);

                    this.GraphicsDevice.Clear(Color.Black);



                    if (Game1.SplashDone)
                    {
                        zoomBatch.Begin();
                        RenderingPipe.DrawScreen(zoomBatch);
                        zoomBatch.End();
                    }
                    else
                    {
                        int length = Game1.SplashScreens.Count;
                        for (int i = 0; i < length; i++)
                        {
                            LogoScreen item = Game1.SplashScreens[i];
                            if (!item.Done())
                            {
                                item.Draw(zoomBatch);
                                break;
                            }

                            if (i == length - 1)
                            {
                                Game1.SplashDone = true;

                                //Initialize main menu
                                GUI.MainMenu.MainMenu.Initialize();
                                this.IsMouseVisible = true;
                            }
                        }
                    }

                    //set rendering back to the back buffer
                    this.GraphicsDevice.SetRenderTarget(null);

                    //render target to back buffer
                    zoomBatch.Begin();

                    int width  = (int)(this.GraphicsDevice.DisplayMode.Width * RenderInfo.Zoom);
                    int height = (int)(this.GraphicsDevice.DisplayMode.Height * RenderInfo.Zoom);

                    zoomBatch.Draw(target, new Rectangle(0, 0, width, height), Color.White);
                    RenderingPipe.DrawGUI(zoomBatch);

                    zoomBatch.End();
                }
            }
            base.Draw(gameTime);
        }