Which text class should I use in a HUD?

Hello, which class should I use for a HUD and why. The HUD will have refreshing elements like money and a custom TTF font.

  • ccui.LabelBMFont
  • cc.LabelBMFont
  • cc.LabelTTF
  • ccui.RichText
  • ccui.Text

I believe this should be in CocosCreator category instead of cocos2d-x. As a cocos2d-x user, I often use TTF.

auto lbl = Label::createWithTTF(....);

Thanks for your answer. I am not using creator, but JS. I just want to know which should I use and why.

Is there a particular reason that you choose TTF instead of BMFont?

TTF are vector, BM are bitmap - so vector fonts scale much better but are more limited in their look
Unless you want multi-coloured characters, TTF are probably best suited

Oh I see.

The difference between the two is BMFont or Bitmap Fonts are basically images with letters in it. So technically, you can go crazy and do some artsy stuff there, i.e. make letter “o” a donut. Whereas TTFs are like the fonts in you desktop/laptop. You get the TTF file, i.e. Arial.ttf, then use it in the game. Not much of customization aside from Bold, Italic, etc.

Hi. Don’t use TTF font for HUD with refreshing elements. very bad fps drop even in powerful PCs. (Test for yourself). BMFont is ok then use it.

I don’t know why but didn’t get response notifications in my mail, so sorry for the delay.

Thanks for the advices! So for now I will use ccui.Text which is a vector font, because I currently have a TTF font I want to use, but If I start noticing some fps drops, or performance issues, I would try to convert it to a bitmap font.

Thanks you all.

I still don’t know the difference between the classes though. What’s the difference between cc.LabelBMFont and ccui.LabelBMFont, and between cc.LabelTTF and ccui.Text.

I will be using ccui.Text because it was the first I got working, not necessarily because it is the best suited for the job.

I guess that will remain a non documented secret for now. That’s a pitty.