/// <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); }
/* * init with CCTexture2D */ public bool InitWithTexture(CCTexture2D tex, int capacity) { TextureAtlas.InitWithTexture(tex, capacity); // no lazy alloc in this node m_pChildren = new CCRawList <CCNode>(capacity); m_tBlendFunc = CCBlendFunc.AlphaBlend; return(true); }
/* * init with CCTexture2D */ public bool InitWithTexture(CCTexture2D tex, int capacity) { TextureAtlas.InitWithTexture(tex, capacity); // no lazy alloc in this node m_pChildren = new CCRawList <CCNode>(capacity); m_tBlendFunc.Source = CCMacros.CCDefaultSourceBlending; m_tBlendFunc.Destination = CCMacros.CCDefaultDestinationBlending; //setShaderProgram(CCShaderCache::sharedShaderCache().programForKey(kCCShader_PositionTextureColor)); return(true); }
protected virtual bool InitWithTexture(CCTexture2D tex, int capacity) { m_blendFunc = CCBlendFunc.AlphaBlend; 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 CCRawList <CCNode>(capacity); m_pobDescendants = new CCRawList <CCSprite>(capacity); return(true); }
public bool InitWithTexture(CCTexture2D texture, int tileWidth, int tileHeight, int itemsToRender) { m_uItemWidth = tileWidth; m_uItemHeight = tileHeight; m_tColorUnmodified = CCTypes.CCWhite; m_bIsOpacityModifyRGB = true; m_tBlendFunc = CCBlendFunc.AlphaBlend; m_pTextureAtlas = new CCTextureAtlas(); m_pTextureAtlas.InitWithTexture(texture, itemsToRender); UpdateBlendFunc(); UpdateOpacityModifyRgb(); CalculateMaxItems(); m_uQuadsToDraw = itemsToRender; return(true); }
protected virtual bool InitWithTexture(CCTexture2D tex, int capacity) { m_blendFunc = CCBlendFunc.AlphaBlend; 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 CCRawList<CCNode>(capacity); m_pobDescendants = new CCRawList<CCSprite>(capacity); return true; }
/// <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; }
public bool InitWithTexture(CCTexture2D texture, int tileWidth, int tileHeight, int itemsToRender) { m_uItemWidth = tileWidth; m_uItemHeight = tileHeight; m_tColorUnmodified = CCTypes.CCWhite; m_bIsOpacityModifyRGB = true; m_tBlendFunc = CCBlendFunc.AlphaBlend; m_pTextureAtlas = new CCTextureAtlas(); m_pTextureAtlas.InitWithTexture(texture, itemsToRender); UpdateBlendFunc(); UpdateOpacityModifyRgb(); CalculateMaxItems(); m_uQuadsToDraw = itemsToRender; return true; }
void _spAtlasPage_createTexture(AtlasPage self, string path) { CCTexture2D texture = CCTextureCache.SharedTextureCache.AddImage(path); CCTextureAtlas textureAtlas = new CCTextureAtlas(); textureAtlas.InitWithTexture(texture, 128); textureAtlas.DrawQuads(); //retain(); self.rendererObject = textureAtlas; self.width = texture.PixelsWide; self.height = texture.PixelsHigh; }