#region usings using System; using SM.Base.Scene; using SM.Base.Types; using SM.Base.Window; using SM2D.Types; #endregion namespace SM2D.Scene { /// public class ItemCollection : GenericItemCollection { /// public ItemCollection() { Transform.Size = new CVector2(1); } /// public override void Draw(DrawContext context) { this.Sort(Comparitor); base.Draw(context); } private int Comparitor(IShowItem a, IShowItem b) { if (a is ITransformItem ta) { if (b is ITransformItem tb) { return (int)((ta.Transform.GetMatrix()[3, 2] - tb.Transform.GetMatrix()[3, 2]) * Transformation.ZIndexPercision); } else return 1; } else { return -1; } } } }