cocos2d-x默认字体修改之CCLabelTTF, 修改为微软雅黑

前端之家收集整理的这篇文章主要介绍了cocos2d-x默认字体修改之CCLabelTTF, 修改为微软雅黑前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
bool CCLabelTTF::initWithString(const char *string,const char *fontName,float fontSize,const cocos2d::CCSize &dimensions,CCTextAlignment hAlignment,CCVerticalTextAlignment vAlignment)
{
    if (CCSprite::init())
    {
        // shader program
        this->setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(SHADER_PROGRAM));
        
        m_tDimensions = CCSizeMake(dimensions.width,dimensions.height);
        m_hAlignment  = hAlignment;
        m_vAlignment  = vAlignment;
        //m_pFontName   = new std::string(fontName);
		m_pFontName   = new std::string("Microsoft Yahei");
        m_fFontSize   = fontSize;
        
        this->setString(string);
        
        return true;
    }
    
    return false;
}
原文链接:https://www.f2er.com/cocos2dx/345530.html

猜你在找的Cocos2d-x相关文章