public void Draw(GameTime gameTime)
        {
            UpdateFrameCounter();

            // Everything between penumbra.BeginDraw and penumbra.Draw will be
            // lit by the lighting system.

            Penumbra.BeginDraw();

            graphics.Clear(BackgroundColor);

            if (tBody != null)
            {
                spriteBatch.Begin();

                // Draw the texture of the MGLogo
                spriteBatch.Draw(MGLogo, new Vector2(-7 + ViewportWidth - MGLogo.Width / 2, 7 + MGLogo.Height / 2), null,
                                 Color.White, 0, new Vector2(MGLogo.Width / 2, MGLogo.Height / 2), 1f, SpriteEffects.None, 0);

                // Draw the texture of the physics body
                spriteBatch.Draw(tBodyTexture, ConvertUnits.ToDisplayUnits(tBody.Position), null,
                                 Color.White, tBody.Rotation, tBodyOrigin, tBodyScale, SpriteEffects.None, 0);

                spriteBatch.End();
            }

            Penumbra.Draw();

            DrawPhysicsDebugView();
            DrawDisplay();
        }
        public void Draw(GameTime gameTime)
        {
            UpdateFrameCounter();

            // Everything between penumbra.BeginDraw and penumbra.Draw will be
            // lit by the lighting system.

            Penumbra.BeginDraw();

            graphics.Clear(BackgroundColor);

            DrawBeginCamera2D();

            //Draw sprites here, so they will affected by the camera movement

            spriteBatch.Draw(CenterTexture, new Vector2(ViewportWidth / 2, ViewportHeight / 2), Color.White);
            spriteBatch.Draw(MoveCamTexture, new Vector2(-150 + ViewportWidth / 2, ViewportHeight / 2), null, Color.White,
                             0f, new Vector2(MoveCamTexture.Width / 2, MoveCamTexture.Height / 2), 1f, SpriteEffects.None, 0f);

            DrawEndCamera2D();

            DrawPhysicsDebugView();
            Penumbra.Draw();

            DrawDisplay();
        }
Ejemplo n.º 3
0
        public void Draw(GameTime gameTime)
        {
            Penumbra.BeginDraw();
            Penumbra.Transform = Camera.Transform;
            Game.GraphicsDevice.Clear(Color.Black);

            SpriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointWrap, null, null, null, Camera.Transform);
            DrawToWorld();
            SpriteBatch.End();

            Penumbra.Draw(gameTime);

            SpriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, null, null, null, null, Camera.Transform);
            DrawToWorldWithoutShader();
            SpriteBatch.End();

            SpriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointWrap, null, null, null, null);
            DrawUserInterface();
            SpriteBatch.End();

            SpriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.Additive, null, null, null, null, Camera.Transform);
            DrawToWorldAdditiveBlend();
            SpriteBatch.End();
        }