1.方法一;使用LabelAtlas类
LabelAtlas* diceCount = LabelAtlas::create("100:", "nums_font.png", 14, 21, '0');
addChild(diceCount);
2.方法二:使用图片截取
Sprite *m_timeSpr = Sprite::create("mzi.png" , Rect(0,0,39.6,77));
m_timeSpr->setPosition(Vec2(AnenaSize.width*0.56, AnenaSize.height*0.73));
m_timeSpr->setVisible(false);
addChild(m_timeSpr);
更改截取面积:
m_timeSpr->setTextureRect(Rect(39.6*m_MatchTime,0,39.6,77));