public static CCSprite spriteWithTexture(CCTexture2D texture, CCRect rect) { CCSprite sprite = new CCSprite(); if ((sprite != null) && sprite.initWithTexture(texture, rect)) { return(sprite); } sprite = null; return(null); }
/// <summary> /// Creates an sprite with a texture. /// The rect used will be the size of the texture. /// The offset will be (0,0). /// </summary> public static CCSprite spriteWithTexture(CCTexture2D texture) { CCSprite sprite = new CCSprite(); if (sprite != null && sprite.initWithTexture(texture)) { return(sprite); } sprite = null; return(null); }
private void LoadWordText() { CCSprite sprite = new CCSprite(); CCTexture2D texture = new CCTexture2D(); switch (Platform.QuestionLanguage) { case Lib.Core.Language.Chinese: texture.initWithString(m_Word.ChineseName, "ChineseContent", 20,Color.White,Color.Transparent); break; case Lib.Core.Language.Enlish: default: texture.initWithString(m_Word.EnglishName, "EnglishContent", 20, Color.White, Color.Transparent); break; } sprite.initWithTexture(texture); sprite.Color = new ccColor3B(Color.White); sprite.position = new CCPoint((m_Size.width / 2) - (sprite.contentSize.width / 2) - m_StillWhile, (sprite.contentSize.height / 2)); addChild(sprite); }
/// <summary> /// Creates an sprite with a texture and a rect. /// The offset will be (0,0). /// </summary> public static CCSprite spriteWithTexture(Texture texture, CCRect rect) { CCSprite sprite = new CCSprite(); if (sprite != null && sprite.initWithTexture(texture, rect)) { return sprite; } sprite = null; return null; }
/// <summary> /// Creates an sprite with a texture. /// The rect used will be the size of the texture. /// The offset will be (0,0). /// </summary> public static CCSprite spriteWithTexture(CCTexture2D texture) { CCSprite sprite = new CCSprite(); if (sprite != null && sprite.initWithTexture(texture)) { return sprite; } sprite = null; return null; }