示例#1
0
        public bool InitWithTileFile(string tile, int tileWidth, int tileHeight, int itemsToRender)
        {
            Debug.Assert(tile != null, "title should not be null");

            m_uItemWidth = tileWidth;
            m_uItemHeight = tileHeight;

            m_cOpacity = 255;
            m_tColor = m_tColorUnmodified = CCTypes.CCWhite;
            m_bIsOpacityModifyRGB = true;

            m_tBlendFunc.Source = CCMacros.CCDefaultSourceBlending;
            m_tBlendFunc.Destination = CCMacros.CCDefaultDestinationBlending;

            var pNewAtlas = new CCTextureAtlas();
            pNewAtlas.InitWithFile(tile, itemsToRender);

            TextureAtlas = pNewAtlas;

            UpdateBlendFunc();
            UpdateOpacityModifyRgb();

            CalculateMaxItems();

            m_uQuadsToDraw = itemsToRender;

            return true;
        }
示例#2
0
        /// <summary>
        /// creates a TextureAtlas with an filename and with an initial capacity for Quads.
        /// The TextureAtlas capacity can be increased in runtime.
        /// </summary>
        public static CCTextureAtlas Create(string file, int capacity)
        {
            var pTextureAtlas = new CCTextureAtlas();
            if (pTextureAtlas.InitWithFile(file, capacity))
            {
                return pTextureAtlas;
            }

            return null;
        }