cclabelttf

Cocos2d: How to Align CCLabelTtf vertically with different font size?

守給你的承諾、 提交于 2020-01-17 13:46:30
问题 How to aligh two CCLabelTtf vertically with different font size? Thanks This is how I am creating labels: for (int i = 0; i < 5; i++) { CCLabelTTF *label = [CCLabelTTF labelWithString:@"11km 90m" fontName:@"Limelight.ttf" fontSize:20]; label.anchorPoint = ccp(0.5, 0.5); label.position = ccp((size.width-225)/2 + 30, size.height - (size.height-260)/2 -i * 40 - 28); [self addChild:label]; CCLabelTTF *label1 = [CCLabelTTF labelWithString:@"2013/11/22" fontName:@"Limelight.ttf" fontSize:15];

Cocos2d: How to Align CCLabelTtf vertically with different font size?

自作多情 提交于 2020-01-17 13:46:14
问题 How to aligh two CCLabelTtf vertically with different font size? Thanks This is how I am creating labels: for (int i = 0; i < 5; i++) { CCLabelTTF *label = [CCLabelTTF labelWithString:@"11km 90m" fontName:@"Limelight.ttf" fontSize:20]; label.anchorPoint = ccp(0.5, 0.5); label.position = ccp((size.width-225)/2 + 30, size.height - (size.height-260)/2 -i * 40 - 28); [self addChild:label]; CCLabelTTF *label1 = [CCLabelTTF labelWithString:@"2013/11/22" fontName:@"Limelight.ttf" fontSize:15];

Trying to set up a CCLabelTTF with an integer as part of it's string in Cocos2d-X C++

∥☆過路亽.° 提交于 2019-12-23 10:00:17
问题 So in Objective-C with Cocos2d, I'd use a NSMutableString with format to put a variable (score) into a string. I'd take that string and use a CCLabel to place it on the screen. Using Cocos2D-x, I'm having trouble finding a way to get this result. A simple example would be great. Thanks! 回答1: int score = 35; float time = 0.03; char* name = "Michael"; char text[256]; sprintf(text,"name is %s, time is %.2f, score is %d", name, time, score); CCLabelTTF* label = CCLabelTTF::labelWithString(text,

How can I add a font to my Cocos2D iOS project and use it with a CCLabelTTF?

风流意气都作罢 提交于 2019-11-28 18:56:16
I need to use a custom font with my Cocos2D project. I've tried a few techniques, but Cocos2D keeps reporting: Unable to load font XXX.ttf Why can't I get my custom font to work with with Cocos2D? ADDITIONAL INFORMATION This is a Question+Answer post. This has been a problem that has had me beating my head against a wall all morning. After reading through numerous solutions, across numerous websites, I've discovered that an amalgam of all available solutions was necessary to fix this issue. What has further confounded the problem for some individuals is that you can sometimes get your

How can I add a font to my Cocos2D iOS project and use it with a CCLabelTTF?

断了今生、忘了曾经 提交于 2019-11-27 11:45:48
问题 I need to use a custom font with my Cocos2D project. I've tried a few techniques, but Cocos2D keeps reporting: Unable to load font XXX.ttf Why can't I get my custom font to work with with Cocos2D? ADDITIONAL INFORMATION This is a Question+Answer post. This has been a problem that has had me beating my head against a wall all morning. After reading through numerous solutions, across numerous websites, I've discovered that an amalgam of all available solutions was necessary to fix this issue.