예제 #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)
        {
            var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            frameCounter.Update(deltaTime);

            graphics.GraphicsDevice.Clear(Color.White);

            spriteBatch.Begin(/** this.camera ,*/ SpriteSortMode.FrontToBack, BlendState.AlphaBlend);

            /** draw! **/
            ContentManager.Draw(gameTime);

            spriteBatch.End();


            base.Draw(gameTime);
        }
예제 #2
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            _ParticleEngine.Update(gameTime);

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

            _FrameCounter.Update(deltaTime);
            var fps = $"FPS: {_FrameCounter.AverageFramesPerSecond}, Particles: {_ParticleEngine.TotalNumberOfParticles}";

            this.Window.Title = fps;

            base.Update(gameTime);
        }