public Border(Image fg, Entity fill, CustomSpinner parent)
 {
     this.fg     = fg;
     this.fill   = fill;
     this.parent = parent;
     Depth       = parent.Depth + 2;
     Active      = false;
 }
        private void CreateSprites()
        {
            if (!expanded)
            {
                Calc.PushRandom(randomSeed);
                Image image;

                List <MTexture> atlasSubtextures = GFX.Game.GetAtlasSubtextures(fgDirectory);
                MTexture        mtexture = Calc.Random.Choose(atlasSubtextures);
                int             imgCount = 0;
                bool            c1, c2, c3, c4 = false;
                c1 = false;
                c2 = false;
                c3 = false;

                if (!SolidCheck(new Vector2(X - 4f, Y - 4f)))
                {
                    c1 = true;
                    imgCount++;
                }
                if (!SolidCheck(new Vector2(X + 4f, Y - 4f)))
                {
                    c2 = true;
                    imgCount++;
                }
                if (!SolidCheck(new Vector2(X + 4f, Y + 4f)))
                {
                    c3 = true;
                    imgCount++;
                }
                if (!SolidCheck(new Vector2(X - 4f, Y + 4f)))
                {
                    c4 = true;
                    imgCount++;
                }
                // technically this solution is twice as fast! Unfortunately it has side-effects that make this not usable

                /*
                 * image = new Image(mtexture).CenterOrigin();
                 * image.Color = Calc.HexToColor(tint);
                 * Add(image); */
                foreach (Entity entity in Scene.Tracker.GetEntities <CustomSpinner>())
                {
                    CustomSpinner crystalStaticSpinner = (CustomSpinner)entity;
                    if (crystalStaticSpinner.ID > ID && crystalStaticSpinner.AttachToSolid == AttachToSolid && (crystalStaticSpinner.Position - Position).LengthSquared() < 576f)
                    {
                        AddSprite((Position + crystalStaticSpinner.Position) / 2f - Position);
                        AddSprite((Position + crystalStaticSpinner.Position) / 2f - Position);
                    }
                }
                if (imgCount == 4)
                {
                    image       = new Image(mtexture).CenterOrigin();
                    image.Color = Tint;
                    Add(image);
                    //image.Visible = false;
                    image.Active = false;
                    //Scene.Add(border = new Border(image, filler, this));
                    GetBorderRenderer().Spinners.Add(this);
                }
                else
                {
                    // only spawn quarter images if it's needed to avoid edge cases
                    if (c1)
                    {
                        image       = new Image(mtexture.GetSubtexture(0, 0, 14, 14, null)).SetOrigin(12f, 12f);
                        image.Color = Tint;
                        Add(image);
                    }
                    if (c2)
                    {
                        image       = new Image(mtexture.GetSubtexture(10, 0, 14, 14, null)).SetOrigin(2f, 12f);
                        image.Color = Tint;
                        Add(image);
                    }
                    if (c3)
                    {
                        image       = new Image(mtexture.GetSubtexture(10, 10, 14, 14, null)).SetOrigin(2f, 2f);
                        image.Color = Tint;
                        Add(image);
                    }
                    if (c4)
                    {
                        image       = new Image(mtexture.GetSubtexture(0, 10, 14, 14, null)).SetOrigin(12f, 2f);
                        image.Color = Tint;
                        Add(image);
                    }
                    //Scene.Add(border = new Border(null, filler, this));
                    GetBorderRenderer().Spinners.Add(this);
                }
                expanded = true;
                Calc.PopRandom();
            }
        }