Example #1
0
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice)
        {
            var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            frameCounter.Update(deltaTime);

            graphicsDevice.Clear(Color.Black);

            /*
             * Background
             */
            spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp);
            spriteBatch.Draw(backgroundGradientStrip, new Rectangle(0, 0, Graphics.PreferredBackBufferWidth, Graphics.PreferredBackBufferHeight), Color.White);
            spriteBatch.End();

            spriteBatch.Begin(samplerState: SamplerState.PointClamp, transformMatrix: Camera.Transform);


            level.Draw(gameTime, spriteBatch);

            player.Draw(gameTime, spriteBatch);
            emitter1.Draw(gameTime, spriteBatch);

            foreach (Sprite s in enemies)
            {
                s.Draw(gameTime, spriteBatch);
            }

            spriteBatch.End();

            spriteBatch.Begin();

            //spriteBatch.DrawString(font, "'X' and 'C' to switch between animations", new Vector2(8, 16), Color.LightGreen);

            spriteBatch.DrawString(font, $"{(frameCounter.CurrentFramesPerSecond)}", Vector2.Zero, Color.LightGreen);
            spriteBatch.DrawString(font, Camera.GetDebugString(), new Vector2(0, 16), Color.Red);

            if (player.Animations.CurrentAnimation != null)
            {
                spriteBatch.DrawString(font, player.Animations.CurrentAnimation.GetDebugInfo(), new Vector2(8, 48), Color.Red);
            }
            spriteBatch.End();
        }