Example #1
0
 protected override void Draw(GameTime gameTime)
 {
     lastTime = gameTime;
     if (screen != null && screen.State == ScreenState.Running)
     {
         screen.Draw(gameTime);
     }
     base.Draw(gameTime);
 }
Example #2
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            if (screen != null)
            {
                screen.Draw(spriteBatch, gameTime);
            }

            base.Draw(gameTime);
        }
Example #3
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="time">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime time)
        {
            drawFps.Enqueue((float)(1000.0 / time.ElapsedGameTime.TotalMilliseconds));
            if (drawFps.Count > 300)
            {
                drawFps.Dequeue();
            }

            GraphicsDevice.Clear(Color.Black);
            screen?.Draw(spriteBatch, time);

            spriteBatch.Begin();
            spriteBatch.DrawString(font, ((int)Math.Round(updateFps.Average())).ToString(), new Vector2(8, 8), Color.Red);
            spriteBatch.DrawString(font, ((int)Math.Round(drawFps.Average())).ToString(), new Vector2(108, 8), Color.Red);
            spriteBatch.End();

            base.Draw(time);
        }
Example #4
0
        public void Draw(GameTime gameTime)
        {
            if (!Stopped)
            {
                GameScreen.Draw(gameTime, SpriteBatch);
            }

            if (Paused)
            {
                float titleTexX = ScreenSize.X / 2 - pausedMenuTitle.Width / 2;

                SpriteBatch.Begin();
                SpriteBatch.Draw(Black, new Rectangle(0, 0, this.GraphicsDeviceManager.PreferredBackBufferWidth, this.GraphicsDeviceManager.PreferredBackBufferHeight), new Color(Color.White, 100));
                SpriteBatch.Draw(pausedMenuTitle, new Vector2(titleTexX, 2), Color.White);
                SpriteBatch.End();
            }

            SpriteBatch.Begin(samplerState: SamplerState.PointWrap);
            if (GamePad.GetState(PlayerIndex.One).IsConnected)
            {
                SpriteBatch.Draw(controllerCursor, MousePos, Color.White);
            }
            SpriteBatch.End();
        }
Example #5
0
 public override void Draw(GameTime gameTime)
 {
     _activeScreen?.Draw(gameTime);
     _activeTransition?.Draw(gameTime);
 }