Пример #1
0
        private void CreateGlow(Drawables.Image image, Texture2D texture, Color?imageGlowColor = null)
        {
            var imageGlow = GlowEffect.CreateGlow(texture, imageGlowColor == null ? glowColor : imageGlowColor.Value, blurX, blurY, dist, angle, alpha, strength, inner, knockout, circleSamplingTimes, linearSamplingTimes, GraphicsDevice);

            // Dispose if the previous texture is not pixel
            if (image.texture != imgPixel)
            {
                image.texture.Dispose();
            }

            image.texture = imageGlow;
        }
Пример #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);


            imgPixel = new Texture2D(GraphicsDevice, 1, 1);
            Color[] _Color = new Color[1];
            _Color[0] = Color.White;
            imgPixel.SetData(_Color);

            arialSpriteFont       = Content.Load <SpriteFont>("Arial");
            cooperBlackSpriteFont = Content.Load <SpriteFont>("CooperBlack");

            imgSurge  = Content.Load <Texture2D>("surge");
            imgDragon = Content.Load <Texture2D>("Dragon");
            imgTroll  = Content.Load <Texture2D>("Troll");

            var lineSpace = 42;

            var pos = new Vector2(50, 20);

            drawList.Add(new Drawables.Text(arialSpriteFont, "Color:", pos, Color.White));

            var posLeftColor = pos.X + 100;

            pos = new Vector2(posLeftColor, pos.Y);
            CreateSquareColor(pos, Color.White, true);
            pos.X += 45;
            CreateSquareColor(pos, Color.Yellow);
            pos.X += 45;
            CreateSquareColor(pos, Color.LightGreen);
            pos.X += 45;
            CreateSquareColor(pos, Color.MediumVioletRed);
            pos.X += 45;
            CreateSquareColor(pos, Color.LightSkyBlue);
            pos.X += 45;
            CreateSquareColor(pos, Color.GreenYellow);
            pos.X += 45;
            CreateSquareColor(pos, Color.Pink);
            pos.X  = posLeftColor;
            pos.Y += 45;
            CreateSquareColor(pos, Color.LightGray);
            pos.X += 45;
            CreateSquareColor(pos, Color.Gray);
            pos.X += 45;
            CreateSquareColor(pos, Color.DarkGray);
            pos.X += 45;
            CreateSquareColor(pos, Color.Olive);
            pos.X += 45;
            CreateSquareColor(pos, Color.Cyan);
            pos.X += 45;
            CreateSquareColor(pos, Color.Orange);
            pos.X += 45;
            CreateSquareColor(pos, Color.Magenta);

            pos = new Vector2(50, 150);
            CreateOptionNumber("Blur X", pos, blurX, 5f, value => blurX = value);

            pos.Y += lineSpace;
            CreateOptionNumber("Blur Y", pos, blurY, 5f, value => blurY = value);

            pos.Y += lineSpace;
            CreateOptionNumber("Dist", pos, dist, 1f, value => dist = value);

            pos.Y += lineSpace;
            CreateOptionNumber("Angle", pos, angle, 1f, value => angle = value);

            pos.Y += lineSpace;
            CreateOptionNumber("Alpha", pos, alpha, 1f, value => alpha = value);

            pos.Y += lineSpace;
            CreateOptionNumber("Strength", pos, strength, 1f, value => strength = value);

            pos.Y += lineSpace;
            CreateOptionNumber("Inner", pos, inner, 1f, value => inner = value);

            pos.Y += lineSpace;
            CreateOptionNumber("Knockout", pos, knockout, 1f, value => knockout = value);

            pos.Y += lineSpace;
            CreateOptionNumber("Circle sampling times", pos, circleSamplingTimes, 1f, value => circleSamplingTimes = value);

            pos.Y += lineSpace;
            CreateOptionNumber("Linear sampling times", pos, linearSamplingTimes, 1f, value => linearSamplingTimes = value);

            pos = new Vector2(550, 15);

            CreateAndAddImageObject(new Drawables.Image(imgPixel, new Rectangle(520, 15, 2, 650)))
            .color = Color.Yellow;

            imgObjFpsText = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(600, 0)));

            imgObjSurge = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(650, 90)));

            imgObjDragon = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(600, 210)));

            imgObjTroll = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(570, 400)));

            UpdateTextureOutlines();
        }
Пример #3
0
 private Drawables.Image CreateAndAddImageObject(Drawables.Image imgObj)
 {
     drawList.Add(imgObj);
     return(imgObj);
 }