Example #1
0
 public CCBatchCommand(float globalZOrder, CCBlendFunc blendType, CCTextureAtlas texture, CCAffineTransform modelViewTransform, int flags)
     : base(globalZOrder, modelViewTransform, flags)
 {
     CommandType = CommandType.BATCH_COMMAND;
     Texture     = texture;
     BlendType   = blendType;
 }
 public CCBatchCommand(float globalZOrder, CCBlendFunc blendType, CCTextureAtlas texture, CCAffineTransform modelViewTransform, int flags) 
     : base(globalZOrder, modelViewTransform, flags)
 {
     CommandType = CommandType.BATCH_COMMAND;
     Texture = texture;
     BlendType = blendType;
 }
Example #3
0
        public CCSpriteBatchNode(CCTexture2D tex, int capacity = defaultSpriteBatchCapacity)
        {
            BlendFunc = CCBlendFunc.AlphaBlend;

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

            TextureAtlas = new CCTextureAtlas(tex, capacity);

            // no lazy alloc in this node
            Children    = new CCRawList <CCNode>(capacity);
            Descendants = new CCRawList <CCSprite>(capacity);
        }
        public CCSpriteBatchNode(CCTexture2D tex, int capacity=defaultSpriteBatchCapacity)
        {
            BlendFunc = CCBlendFunc.AlphaBlend;

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

            TextureAtlas = new CCTextureAtlas(tex, capacity);

            // no lazy alloc in this node
            Children = new CCRawList<CCNode>(capacity);
            Descendants = new CCRawList<CCSprite>(capacity);
        }
Example #5
0
        public CCAtlasNode(CCTexture2D texture, int tileWidth, int tileHeight, int itemsToRender)
        {
            ItemWidth  = tileWidth;
            ItemHeight = tileHeight;

            ColorUnmodified    = CCColor3B.White;
            IsOpacityModifyRGB = false;
            BlendFunc          = CCBlendFunc.AlphaBlend;

            TextureAtlas = new CCTextureAtlas(texture, itemsToRender);

            UpdateBlendFunc();
            UpdateOpacityModifyRgb();

            CalculateMaxItems();
            QuadsToDraw = itemsToRender;
        }
Example #6
0
        public Atlas1()
        {
			m_textureAtlas = new CCTextureAtlas (TestResource.s_AtlasTest, 3);
            //m_textureAtlas.retain();
        }
Example #7
0
 public CCBatchCommand(float globalZOrder, CCBlendFunc blendType, CCTextureAtlas texture)
     : this(globalZOrder, blendType, texture, CCAffineTransform.Identity, 0)
 {
 }
 public CCParticleBatchNode(CCTexture2D tex, int capacity = ParticleDefaultCapacity)
 {
     BlendFunc = CCBlendFunc.AlphaBlend;
     TextureAtlas = new CCTextureAtlas(tex, capacity);
     Children = new CCRawList<CCNode>(capacity);
 }
Example #9
0
 public CCParticleBatchNode(CCTexture2D tex, int capacity = ParticleDefaultCapacity)
 {
     BlendFunc    = CCBlendFunc.AlphaBlend;
     TextureAtlas = new CCTextureAtlas(tex, capacity);
     Children     = new CCRawList <CCNode>(capacity);
 }
Example #10
0
        protected void InitCCLabelBMFont(string theString, string fntFile, CCSize dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment,
            CCPoint imageOffset, CCTexture2D texture)
        {
            Debug.Assert(FontConfiguration == null, "re-init is no longer supported");
            Debug.Assert((theString == null && fntFile == null) || (theString != null && fntFile != null),
                "Invalid params for CCLabelBMFont");

            if (!String.IsNullOrEmpty(fntFile))
            {
                CCBMFontConfiguration newConf = FNTConfigLoadFile(fntFile);
                if (newConf == null)
                {
                    CCLog.Log("CCLabelBMFont: Impossible to create font. Please check file: '{0}'", fntFile);
                    return;
                }

                FontConfiguration = newConf;

                fntConfigFile = fntFile;

                if (texture == null)
                {
                    try
                    {
                        texture = CCTextureCache.SharedTextureCache.AddImage(FontConfiguration.AtlasName);
                    }
                    catch (Exception)
                    {
                        // Try the 'images' ref location just in case.
                        try
                        {
                            texture =
                                CCTextureCache.SharedTextureCache.AddImage(System.IO.Path.Combine("images",
                                    FontConfiguration
                                    .AtlasName));
                        }
                        catch (Exception)
                        {
                            // Lastly, try <font_path>/images/<font_name>
                            string dir = System.IO.Path.GetDirectoryName(FontConfiguration.AtlasName);
                            string fname = System.IO.Path.GetFileName(FontConfiguration.AtlasName);
                            string newName = System.IO.Path.Combine(System.IO.Path.Combine(dir, "images"), fname);
                            texture = CCTextureCache.SharedTextureCache.AddImage(newName);
                        }
                    }
                }
            }
            else
            {
                texture = new CCTexture2D();
            }

            if (String.IsNullOrEmpty(theString))
            {
                theString = String.Empty;
            }

            TextureAtlas = new CCTextureAtlas(texture, theString.Length);

            this.labelDimensions = dimensions;

            horzAlignment = hAlignment;
            vertAlignment = vAlignment;

            IsOpacityCascaded = true;

            ContentSize = CCSize.Zero;

            IsColorModifiedByOpacity = TextureAtlas.Texture.HasPremultipliedAlpha;
            AnchorPoint = CCPoint.AnchorMiddle;

            ImageOffset = imageOffset;

            SetString(theString, true);
        }
Example #11
0
        protected void InitCCLabelBMFont(string theString, string fntFile, CCSize dimensions, CCTextAlignment hAlignment, CCVerticalTextAlignment vAlignment,
                                         CCPoint imageOffset, CCTexture2D texture)
        {
            Debug.Assert(FontConfiguration == null, "re-init is no longer supported");
            Debug.Assert((theString == null && fntFile == null) || (theString != null && fntFile != null),
                         "Invalid params for CCLabelBMFont");

            if (!String.IsNullOrEmpty(fntFile))
            {
                CCBMFontConfiguration newConf = FNTConfigLoadFile(fntFile);
                if (newConf == null)
                {
                    CCLog.Log("CCLabelBMFont: Impossible to create font. Please check file: '{0}'", fntFile);
                    return;
                }

                FontConfiguration = newConf;

                fntConfigFile = fntFile;

                if (texture == null)
                {
                    try
                    {
                        texture = CCTextureCache.SharedTextureCache.AddImage(FontConfiguration.AtlasName);
                    }
                    catch (Exception)
                    {
                        // Try the 'images' ref location just in case.
                        try
                        {
                            texture =
                                CCTextureCache.SharedTextureCache.AddImage(System.IO.Path.Combine("images",
                                                                                                  FontConfiguration
                                                                                                  .AtlasName));
                        }
                        catch (Exception)
                        {
                            // Lastly, try <font_path>/images/<font_name>
                            string dir     = System.IO.Path.GetDirectoryName(FontConfiguration.AtlasName);
                            string fname   = System.IO.Path.GetFileName(FontConfiguration.AtlasName);
                            string newName = System.IO.Path.Combine(System.IO.Path.Combine(dir, "images"), fname);
                            texture = CCTextureCache.SharedTextureCache.AddImage(newName);
                        }
                    }
                }
            }
            else
            {
                texture = new CCTexture2D();
            }

            if (String.IsNullOrEmpty(theString))
            {
                theString = String.Empty;
            }

            TextureAtlas = new CCTextureAtlas(texture, theString.Length);

            this.labelDimensions = dimensions;

            horzAlignment = hAlignment;
            vertAlignment = vAlignment;

            IsOpacityCascaded = true;

            ContentSize = CCSize.Zero;

            IsColorModifiedByOpacity = TextureAtlas.Texture.HasPremultipliedAlpha;
            AnchorPoint = CCPoint.AnchorMiddle;

            ImageOffset = imageOffset;

            SetString(theString, true);
        }
Example #12
0
        public CCAtlasNode(CCTexture2D texture, int tileWidth, int tileHeight, int itemsToRender)
        {
            ItemWidth = tileWidth;
            ItemHeight = tileHeight;

            ColorUnmodified = CCColor3B.White;
            IsOpacityModifyRGB = false;
            BlendFunc = CCBlendFunc.AlphaBlend; 

            TextureAtlas = new CCTextureAtlas(texture, itemsToRender);

            UpdateBlendFunc();
            UpdateOpacityModifyRgb();

            CalculateMaxItems();
            QuadsToDraw = itemsToRender;
        }
        public CCBatchCommand(float globalZOrder, CCBlendFunc blendType, CCTextureAtlas texture) 
            : this(globalZOrder, blendType, texture, CCAffineTransform.Identity, 0)
        {


        }