TuftEntertainment / hashtag-warrior

Open-source iOS game powered by cocos2d.
MIT License
8 stars 7 forks source link

Change score/hashtag text nodes to use CCLabelBMFont #42

Open danielgwood opened 11 years ago

danielgwood commented 11 years ago

Currently the score indicator and hashtag indicator at the top of the game scene use the CCLabelTTF class. This is not optimal, because each time setText() is called, a new texture is created and loaded, so there will be a significant performance impact once those labels are updating regularly.

CCLabelBMFont is apparently much more optimal for this, as it relies on a bitmapped font atlas - thus all the textures are created ahead of time.

verbitan commented 11 years ago

Did the book have any good suggestions for creating Bitmap fonts? Texturepacker seems unable to do so and without paying £25 I can't get Glyph Designer to do anything useful...

danielgwood commented 11 years ago

Some other alternatives: http://www.bmglyph.com/ http://www.angelcode.com/products/bmfont/ https://code.google.com/p/libgdx/wiki/Hiero

verbitan commented 11 years ago

Ok I had a go at this and it worked fine. The trouble is you obviously have to set the size of the font in the image, but this then means that font is really small when you go all the way up to iPad Retina.

So... I propose that we adopt the following naming convention - "[Font name][Font pt on iPhone SD].fnt". We then create the -hd, -ipad and -ipadhd versions of the same font at a higher pt which has been scaled up by a fixed factor that looks equivalent on those devices.

e.g. Arial12.fnt - Actually 12pt Arial12-hd.fnt - Actually 16pt Arial12-ipad.fnt - Actually 24pt Arial12-ipadhd.fnt - Actually 36pt

danielgwood commented 11 years ago

Seems sensible! You've probably already realised, but this change also needs to be applied to the tweet-stream part at the bottom of the screen - that text also updates a lot. This is a bit tricky though, as you tend to get quite a variety of characters in Tweets..

verbitan commented 11 years ago

Yeah I was going to apply this to everything, seems for the best. I'll take this one on then.