Skip to content

Instantly share code, notes, and snippets.

@sag333ar
Created September 4, 2014 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sag333ar/7c6610cebe06de6c4638 to your computer and use it in GitHub Desktop.
Save sag333ar/7c6610cebe06de6c4638 to your computer and use it in GitHub Desktop.
Create label in Cocos2d-x & set few properties
// create label with text, font and font size
auto label = LabelTTF::create("Wheel of Fortune", "Marker Felt", 20);
// get the size of the label
Size labelSize = label->getDimensions();
// set the position of the label
label->setPosition(Vec2(20,20));
// set the text color of the label
label->setColor(Color3B(255.0, 0.0, 0.0));
// add the label to your scene-layer
this->addChild(label, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment