本文整理汇总了C++中LabelTTF::getBoundingBox方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelTTF::getBoundingBox方法的具体用法?C++ LabelTTF::getBoundingBox怎么用?C++ LabelTTF::getBoundingBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelTTF
的用法示例。
在下文中一共展示了LabelTTF::getBoundingBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !Layer::init() )
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
Sprite *bg = Sprite::create("bg.jpg");
bg->setPosition(visibleSize/2);
addChild(bg);
LabelTTF *label = LabelTTF::create("Show Next Scene", "Coureir", 36);
addChild(label);
label->setPosition(visibleSize/2);
EventListenerTouchOneByOne *listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = [label](Touch *t,Event *e){
if (label->getBoundingBox().containsPoint(t->getLocation())) {
Director::getInstance()->replaceScene(TransitionPageTurn::create (1,ImageScene::createScene(),0));
};
return false;
};
Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, label);
return true;
}