Ejemplo n.º 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)
        {
            GraphicsDevice.Clear(SkyColor);
            GraphicsDevice.BlendState        = BlendState.Opaque;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            foreach (var c in chunks)
            {
                c.Render(camera);
            }

            if (linebox != null)
            {
                linebox.Render(camera);
            }

            // 2D drawing
            if (!WireframeToggle)
            {
                GraphicsDevice.BlendState = BlendState.AlphaBlend;

                var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

                frameCounter.Update(deltaTime);

                var fps = string.Format("FPS: {0}", frameCounter.AverageFramesPerSecond);

                spriteBatch.Begin();

                TempDrawCrosshairs(spriteBatch);

                spriteBatch.DrawString(font, fps, new Vector2(1, 1), Color.Black);
                spriteBatch.DrawString(font, output, new Vector2(20, 20), Color.Black);
                spriteBatch.End();
            }
            base.Draw(gameTime);
        }