本文整理汇总了C#中Cocos2D.CCTexture2D.InitWithString方法的典型用法代码示例。如果您正苦于以下问题:C# CCTexture2D.InitWithString方法的具体用法?C# CCTexture2D.InitWithString怎么用?C# CCTexture2D.InitWithString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cocos2D.CCTexture2D
的用法示例。
在下文中一共展示了CCTexture2D.InitWithString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: updateTexture
private void updateTexture()
{
CCTexture2D tex;
// Dump the old one
if (Texture != null)
{
Texture.Dispose();
}
// let system compute label's width or height when its value is 0
// refer to cocos2d-x issue #1430
tex = new CCTexture2D();
tex.InitWithString(m_pString,
CCMacros.CCSizePointsToPixels(m_tDimensions),
m_hAlignment,
m_vAlignment,
m_pFontName,
m_fFontSize * CCMacros.CCContentScaleFactor());
Texture = tex;
CCRect rect = CCRect.Zero;
rect.Size = m_pobTexture.ContentSize;
SetTextureRect(rect);
}
示例2: updateTexture
private void updateTexture()
{
CCTexture2D tex;
// Dump the old one
if (Texture != null)
{
Texture.Dispose();
}
// let system compute label's width or height when its value is 0
// refer to cocos2d-x issue #1430
tex = new CCTexture2D();
var result = tex.InitWithString(m_pString,
CCMacros.CCSizePointsToPixels(m_tDimensions),
m_hAlignment,
m_vAlignment,
m_pFontName,
m_fFontSize * CCMacros.CCContentScaleFactor());
//#if MONOMAC || IPHONE || IOS
// // There was a problem loading the text for some reason or another if result is not true
// // For MonoMac and IOS Applications we will try to create a Native Label automatically
// // If the font is not found then a default font will be selected by the device and used.
// if (!result && !string.IsNullOrEmpty(m_pString))
// {
// tex = CCLabelUtilities.CreateLabelTexture (m_pString,
// CCMacros.CCSizePointsToPixels (m_tDimensions),
// m_hAlignment,
// m_vAlignment,
// m_pFontName,
// m_fFontSize * CCMacros.CCContentScaleFactor (),
// new CCColor4B(Microsoft.Xna.Framework.Color.White) );
// }
//#endif
Texture = tex;
CCRect rect = CCRect.Zero;
rect.Size = m_pobTexture.ContentSize;
SetTextureRect(rect);
}