当前位置: 首页>>代码示例>>C#>>正文


C# CCTexture2D.InitWithString方法代码示例

本文整理汇总了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);
        }
开发者ID:pekayatt,项目名称:cocos2d-xna,代码行数:27,代码来源:CCLabelTTF.cs

示例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);
        }
开发者ID:huaqiangs,项目名称:cocos2d-xna,代码行数:42,代码来源:CCLabelTTF.cs


注:本文中的Cocos2D.CCTexture2D.InitWithString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。