public bool InitWithTexture(CCTexture2D tex, int capacity)
        {
            m_blendFunc.Source = CCMacros.CCDefaultSourceBlending;
            m_blendFunc.Destination = CCMacros.CCDefaultDestinationBlending;

            m_pobTextureAtlas = new CCTextureAtlas();

            if (capacity == 0)
            {
                capacity = kDefaultSpriteBatchCapacity;
            }

            ContentSize= tex.ContentSize; // @@ TotallyEvil - contentSize should return the size of the sprite sheet
            m_pobTextureAtlas.InitWithTexture(tex, capacity);

            UpdateBlendFunc();

            // no lazy alloc in this node
            m_pChildren = new RawList<CCNode>(capacity);

            m_pobDescendants = new RawList<CCSprite>(capacity);

            return true;
        }
Beispiel #2
0
        /// <summary>
        /// creates a TextureAtlas with a previously initialized Texture2D object, and
        /// with an initial capacity for n Quads. 
        /// The TextureAtlas capacity can be increased in runtime.
        /// </summary>
        public static CCTextureAtlas Create(CCTexture2D texture, int capacity)
        {
            var pTextureAtlas = new CCTextureAtlas();
            if (pTextureAtlas.InitWithTexture(texture, capacity))
            {
                return pTextureAtlas;
            }

            return null;
        }