예제 #1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            camera.BeginDraw(spriteBatch);

            background.Draw(spriteBatch);

            spriteBatch.End();

            Light1.BeginDraw();
            foreach (Light1 light in lights)
            {
                light.Draw();
            }
            Light1.EndDraw(spriteBatch);

            camera.BeginDraw(spriteBatch);

            player.Draw(spriteBatch);
            foreach (Block block in blocks)
            {
                block.Draw(spriteBatch);
            }

            spriteBatch.End();
        }
예제 #2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            camera.BeginDraw(spriteBatch);
            background.Draw(spriteBatch);
            spriteBatch.End();

            LightPolygon.BeginDraw();

            foreach (Light light in lights)
            {
                light.Draw();
            }

            LightPolygon.EndDraw(spriteBatch);

            camera.BeginDraw(spriteBatch);

            player.Draw(spriteBatch);

            foreach (IObstacle obstacle in obstacles)
            {
                obstacle.Draw(spriteBatch);
            }

            spriteBatch.End();
        }
예제 #3
0
        public void Draw(SpriteBatch spriteBatch)
        {
            foreach (Light light in lights)
            {
                light.Draw();
            }

            //BlendState blendState = new BlendState()
            //{
            //    BlendFactor = Color.White, //BlendState.NonPremultiplied.BlendFactor,
            //    ColorBlendFunction = BlendFunction.Add, //BlendFunction.Add, //BlendState.NonPremultiplied.ColorBlendFunction,
            //    ColorDestinationBlend = Blend.DestinationAlpha, //Blend.InverseSourceAlpha, //BlendState.NonPremultiplied.ColorDestinationBlend,
            //    ColorSourceBlend = Blend.InverseDestinationAlpha, //Blend.SourceAlpha, //BlendState.NonPremultiplied.ColorSourceBlend,
            //};

            BlendState blendState = new BlendState()
            {
                BlendFactor           = /*Color.White,*/ BlendState.AlphaBlend.BlendFactor,
                ColorBlendFunction    = /*BlendFunction.Add,*/ BlendState.AlphaBlend.ColorBlendFunction,
                ColorDestinationBlend = Blend.One, /*Blend.DestinationAlpha,*/                            //BlendState.AlphaBlend.ColorDestinationBlend,
                ColorSourceBlend      = Blend.InverseDestinationAlpha, /*Blend.InverseDestinationAlpha,*/ //BlendState.AlphaBlend.ColorSourceBlend,
            };

            spriteBatch.Begin(SpriteSortMode.Deferred, blendState /*BlendState.NonPremultiplied*/, null, null, null, null, camera.Transform);

            background.Draw(spriteBatch);
            spriteBatch.End();

            camera.BeginDraw(spriteBatch);

            player.Draw(spriteBatch);

            foreach (IObstacle obstacle in obstacles)
            {
                obstacle.Draw(spriteBatch);
            }

            spriteBatch.End();
        }