Labels

This page will cover the various labels that Cocos provides

Labels provide a means for displaying text to the user and methods for easily modifying the text as well.

Atlas Label - a label which uses an atlas file for the characters

Example format:

Label( stringToDisplay, characterMapToUse, characterWidth, characterHeight, startingCharacterInTheMap );

LabelAtlas *label = LabelAtlas::create( "String to display", "Filepath of the character map", 5, 5, 3 );
var label = new cc.LabelAtlas( "String to display", "Filepath of the character map", 5, 5 );

Note: *Glypth Designer can be used to create atlas fonts https://71squared.com/en/glyphdesigner

BMFont Label - a label which uses an BMFont file for the characters

Example format:

Label( bmFontFilePath, stringToDisplay );

Label *label = Label::createWithBMFont(  );
var label = new cc.LabelBMFont( "String to display", "Filepath of the bmfont" );

Note: *Glypth Designer can be used to create BMFonts https://71squared.com/en/glyphdesigner

TTF Label - a label which uses a regular font file

Example format:

Label( stringToDisplay, fontFilepath, fontSize );

Label *label = Label::createWithTTF( "String to display", "Font filepath", 5.5 );
var label = new cc.LabelTTF( "String to display", "Font filepath" );