本文整理汇总了C#中cocos2d.CCTexture2D.initWithString方法的典型用法代码示例。如果您正苦于以下问题:C# CCTexture2D.initWithString方法的具体用法?C# CCTexture2D.initWithString怎么用?C# CCTexture2D.initWithString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocos2d.CCTexture2D
的用法示例。
在下文中一共展示了CCTexture2D.initWithString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setString
/// <summary>
/// changes the string to render
/// @warning Changing the string is as expensive as creating a new CCLabelTTF. To obtain better performance use CCLabelAtlas
/// </summary>
public void setString(string label)
{
m_pString = label;
CCTexture2D texture;
if (CCSize.CCSizeEqualToSize(m_tDimensions, new CCSize(0, 0)))
{
texture = new CCTexture2D();
texture.initWithString(label, m_pFontName.ToString(), m_fFontSize);
}
else
{
texture = new CCTexture2D();
texture.initWithString(label, m_tDimensions, m_eAlignment, m_pFontName.ToString(), m_fFontSize);
}
this.Texture = texture;
CCRect rect = new CCRect(0, 0, 0, 0);
rect.size = m_pobTexture.getContentSize();
this.setTextureRect(rect);
}