本文整理汇总了C#中cocos2d.CCSprite.initWithTexture方法的典型用法代码示例。如果您正苦于以下问题:C# CCSprite.initWithTexture方法的具体用法?C# CCSprite.initWithTexture怎么用?C# CCSprite.initWithTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocos2d.CCSprite
的用法示例。
在下文中一共展示了CCSprite.initWithTexture方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadWordText
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);
}
示例2: spriteWithTexture
/// <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;
}
示例3: spriteWithTexture
/// <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;
}