我修改了标准示例“Hello World”:
CCSprite *sprite = [CCSprite spriteWithFile:@"Untitled-1.png"]; CGSize winSize = [CCDirector sharedDirector].winSize; sprite.position = ccp(winSize.width / 2,winSize.height / 2); [label setBlendFunc:(ccBlendFunc){GL_ZERO,GL_SRC_ALPHA}]; [label setColor:ccBLACK]; [sprite addChild:label]; [self addChild:sprite];
我有:
我目前的解决方案是初始化CCLabelTTF:
CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64 dimensions:size hAlignment:kCCTextAlignmentCenter vAlignment:kCCVerticalTextAlignmentCenter];
其中size是[CCDirector sharedDirector] .winSize for my examle.
欢迎任何其他建议