示例#1
0
 protected override void Draw(GameTime gameTime)
 {
     _frameRate.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
     SetWindowTitle($"{Math.Round(_frameRate.AverageFramesPerSecond)} fps");
     ScreenManager.Draw();
     base.Draw(gameTime);
 }
示例#2
0
        public void Draw()
        {
            _spriteBatch.Begin(SpriteSortMode.Deferred,
                               BlendState.AlphaBlend,
                               null,
                               null,
                               null,
                               null,
                               _cameraManager.Transform);
            _screenManager.Draw();
            _world.Draw();

            _spriteBatch.End();
        }
示例#3
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)
        {
            // the reason we calculate the delta time here is since this is the only place where all the drawing "flows together"
            // here we can say that all the drawing is definitely finished after base.Draw is called, so here is the only place we truly
            // can calculate the passed time every frame.
            if (gameTime.TotalGameTime.Milliseconds - mLastFrameTime >= 0)
            {
                mDeltaTime = (gameTime.TotalGameTime.Milliseconds - mLastFrameTime) / 1000;
            }

            GraphicsDevice.Clear(Color.Black);

            mScreenManager.Draw(mSpriteBatch);
            base.Draw(gameTime);

            mLastFrameTime = gameTime.TotalGameTime.Milliseconds;
        }
示例#4
0
 protected override void Draw(GameTime gameTime)
 {
     GraphicsDevice.Clear(Color.CornflowerBlue);
     screenManager.Draw(gameTime);
     base.Draw(gameTime);
 }