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

前端之家收集整理的这篇文章主要介绍了cocos2d-x默认字体修改之CCLabelTTF, 修改为微软雅黑前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. bool CCLabelTTF::initWithString(const char *string,const char *fontName,float fontSize,const cocos2d::CCSize &dimensions,CCTextAlignment hAlignment,CCVerticalTextAlignment vAlignment)
  2. {
  3. if (CCSprite::init())
  4. {
  5. // shader program
  6. this->setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(SHADER_PROGRAM));
  7. m_tDimensions = CCSizeMake(dimensions.width,dimensions.height);
  8. m_hAlignment = hAlignment;
  9. m_vAlignment = vAlignment;
  10. //m_pFontName = new std::string(fontName);
  11. m_pFontName = new std::string("Microsoft Yahei");
  12. m_fFontSize = fontSize;
  13. this->setString(string);
  14. return true;
  15. }
  16. return false;
  17. }

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