我为所需的 x64 ios 更新 cocos2d-iphone。但是我的游戏的 CCLabelBMFont 全部对齐错误。我该如何解决?
我设置
txt.anchorPoint = ccp(.25, .5);
有效。但这不是真正的解决方法。
这里字体资源: http: //pan.baidu.com/s/1sjkDT7n
我编写调试代码:
CGPoint basePot= ccp(0, 500);
CGPoint offsetPot= ccp(0, 40);
{
basePot = ccpSub(basePot, offsetPot);
CCLabelBMFont *txt = [CCLabelBMFont labelWithString:@"12345654321" fntFile:@"font_finish_score.fnt"];
txt.position=basePot;
txt.anchorPoint = ccp(0, .5);
[self addChild:txt];
}
{
basePot = ccpSub(basePot, offsetPot);
CCLabelBMFont *txt = [CCLabelBMFont labelWithString:@"12345654321" fntFile:@"font_finish_score.fnt"];
txt.position=basePot;
txt.anchorPoint = ccp(.5, .5);
[self addChild:txt];
}
{
basePot = ccpSub(basePot, offsetPot);
CCLabelBMFont *txt = [CCLabelBMFont labelWithString:@"12345654321" fntFile:@"font_finish_score.fnt"];
txt.position=basePot;
txt.anchorPoint = ccp(1, .5);
[self addChild:txt];
}
{
basePot = ccpSub(basePot, offsetPot);
CCLabelBMFont *txt = [CCLabelBMFont labelWithString:@"12345654321" fntFile:@"font_finish_score.fnt"];
txt.position=basePot;
txt.alignment = kCCTextAlignmentLeft;
[self addChild:txt];
}
{
basePot = ccpSub(basePot, offsetPot);
CCLabelBMFont *txt = [CCLabelBMFont labelWithString:@"12345654321" fntFile:@"font_finish_score.fnt"];
txt.position=basePot;
txt.alignment = kCCTextAlignmentCenter;
[self addChild:txt];
}
{
basePot = ccpSub(basePot, offsetPot);
CCLabelBMFont *txt = [CCLabelBMFont labelWithString:@"12345654321" fntFile:@"font_finish_score.fnt"];
txt.position=basePot;
txt.alignment = kCCTextAlignmentRight;
[self addChild:txt];
}
对齐不起作用,并且 anthorPoint (.5,.5) 不是中心。烦...
我发现对齐对齐不是智能。“Arial”的 test_font.fnt 效果很好。但是我的乐谱字体“HYZhongYuanJ”对齐不好。