Example #1
0
        /// <summary>
        /// Sorts the <see cref="Children"/> collection according to the order of the visual's
        /// children and their z-index.
        /// </summary>
        /// <param name="scene">The scene that the node is a part of.</param>
        public void SortChildren(Scene scene)
        {
            if (_children == null || _children.Count <= 1)
            {
                return;
            }

            var keys = new List <long>(Visual.VisualChildren.Count);

            for (var i = 0; i < Visual.VisualChildren.Count; ++i)
            {
                var child  = Visual.VisualChildren[i];
                var zIndex = child.ZIndex;
                keys.Add(((long)zIndex << 32) + i);
            }

            keys.Sort();
            _children.Clear();

            foreach (var i in keys)
            {
                var child = Visual.VisualChildren[(int)(i & 0xffffffff)];
                var node  = scene.FindNode(child);

                if (node != null)
                {
                    _children.Add(node);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Dispose and clear component data
        /// </summary>
        public void Dispose()
        {
            Array.Clear(ComponentTypes, 0, ComponentTypes.Length);
            entities.Clear();
            foreach (var component in Components.Values)
            {
                component.Dispose();
            }

            Components.Clear();

            entityToIndex.Dispose();
            entities.Dispose();
            Components.Dispose();
        }
Example #3
0
        public void ForEach_Verify(int count)
        {
            PooledList <T> list         = GenericListFactory(count);
            PooledList <T> visitedItems = new PooledList <T>();

            void action(T item)
            {
                visitedItems.Add(item);
            }

            //[] Verify ForEach looks at every item
            visitedItems.Clear();
            list.ForEach(action);
            VerifyList(list, visitedItems);

            list.Dispose();
            visitedItems.Dispose();
        }
Example #4
0
 private static void Free(PooledList list)
 {
     list.Clear();
     pool.Free(list);
 }
Example #5
0
 internal void Clear()
 {
     PooledList <BufferWriterMemory> .Clear(ref this.spanMessages);
 }