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