为什么cocos2d-iphone v2,v3 x-v2 CCLabelBMFont对齐不是中心?

时间:2014-12-31 17:09:43

标签: cocos2d-iphone bitmap-fonts cocos2d-iphone-2.x

我更新cocos2d-iphone以获取所需的x64 ios。 但是我的游戏的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];
    }

enter image description here

对齐不起作用,而anthorPoint(.5,.5)不是中心。困扰...

我认为对齐对齐不是智力。 test_font.fnt by" Arial"工作得很好。但我的得分字体" HYZhongYuanJ"不要好好对齐。

0 个答案:

没有答案