Пример #1
0
        public static CCTextureAtlas textureAtlasWithTexture(CCTexture2D texture, int capacity)
        {
            CCTextureAtlas cCTextureAtla = new CCTextureAtlas();

            if (cCTextureAtla.initWithTexture(texture, capacity))
            {
                return(cCTextureAtla);
            }
            return(null);
        }
Пример #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 textureAtlasWithTexture(CCTexture2D texture, int capacity)
        {
            CCTextureAtlas pTextureAtlas = new CCTextureAtlas();

            if (pTextureAtlas.initWithTexture(texture, capacity))
            {
                return(pTextureAtlas);
            }

            return(null);
        }
Пример #3
0
        /// <summary>
        ///  initializes a CCSpriteBatchNode with a texture2d and capacity of children.
        ///  The capacity will be increased in 33% in runtime if it run out of space.
        /// </summary>
        /// <param name="tex"></param>
        /// <param name="capacity"></param>
        /// <returns></returns>
        public bool initWithTexture(Texture tex, int capacity)
        {
            m_blendFunc.src = 1;      // CC_BLEND_SRC = 1
            m_blendFunc.dst = 0x0303; // CC_BLEND_DST = 0x0303

            m_pobTextureAtlas = new CCTextureAtlas();
            m_pobTextureAtlas.initWithTexture(tex, capacity);

            updateBlendFunc();

            ContentSize = tex.ContentSize;

            // no lazy alloc in this node
            Children         = new List <Node>();
            m_pobDescendants = new List <CCSprite>();

            return(true);
        }
Пример #4
0
        /// <summary>
        ///  initializes a CCSpriteBatchNode with a texture2d and capacity of children.
        ///  The capacity will be increased in 33% in runtime if it run out of space.
        /// </summary>
        /// <param name="tex"></param>
        /// <param name="capacity"></param>
        /// <returns></returns>
        public bool initWithTexture(CCTexture2D tex, int capacity)
        {
            m_blendFunc.src = 1;      // CC_BLEND_SRC = 1
            m_blendFunc.dst = 0x0303; // CC_BLEND_DST = 0x0303

            m_pobTextureAtlas = new CCTextureAtlas();
            m_pobTextureAtlas.initWithTexture(tex, capacity);

            updateBlendFunc();

            contentSize = tex.getContentSize(); // @@ TotallyEvil - contentSize should return the size of the sprite sheet

            // no lazy alloc in this node
            m_pChildren      = new List <CCNode>();
            m_pobDescendants = new List <CCSprite>();

            return(true);
        }
Пример #5
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 textureAtlasWithTexture(Texture texture, int capacity)
        {
            CCTextureAtlas pTextureAtlas = new CCTextureAtlas();
            if (pTextureAtlas.initWithTexture(texture, capacity))
            {
                return pTextureAtlas;
            }

            return null;
        }
        /// <summary>
        ///  initializes a CCSpriteBatchNode with a texture2d and capacity of children.
        ///  The capacity will be increased in 33% in runtime if it run out of space.
        /// </summary>
        /// <param name="tex"></param>
        /// <param name="capacity"></param>
        /// <returns></returns>
        public bool initWithTexture(CCTexture2D tex, int capacity)
        {
            m_blendFunc.src = 1; // CC_BLEND_SRC = 1
            m_blendFunc.dst = 0x0303; // CC_BLEND_DST = 0x0303

            m_pobTextureAtlas = new CCTextureAtlas();
            m_pobTextureAtlas.initWithTexture(tex, capacity);

            updateBlendFunc();

            contentSize= tex.getContentSize(); // @@ TotallyEvil - contentSize should return the size of the sprite sheet

            // no lazy alloc in this node
            m_pChildren = new List<CCNode>();
            m_pobDescendants = new List<CCSprite>();

            return true;
        }