0

I update cocos2d-iphone for required x64 ios. But my game's CCLabelBMFont all go align error. How can I fix it ?

I set

txt.anchorPoint = ccp(.25, .5);

It worked. But it not the real solution way.

here the font resource: http://pan.baidu.com/s/1sjkDT7n

I write the debug code:

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

alignment don't work , and anthorPoint (.5,.5) not the center. Bothering...

I fount that the alignment align isn't intelligence. test_font.fnt by "Arial" work well. But my score font "HYZhongYuanJ" don't align well.

zszen
  • 1,208
  • 1
  • 13
  • 18

0 Answers0