本文整理汇总了C++中CCLayerColor::setIsRelativeAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLayerColor::setIsRelativeAnchorPoint方法的具体用法?C++ CCLayerColor::setIsRelativeAnchorPoint怎么用?C++ CCLayerColor::setIsRelativeAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLayerColor
的用法示例。
在下文中一共展示了CCLayerColor::setIsRelativeAnchorPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTouchEnabled
// on "init" you need to initialize your instance
bool Bug914Layer::init()
{
// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if (BugsTestBaseLayer::init())
{
setTouchEnabled(true);
// ask director the the window size
CCSize size = CCDirector::sharedDirector()->getWinSize();
CCLayerColor *layer;
for( int i=0;i < 5;i++)
{
layer = CCLayerColor::create(ccc4(i*20, i*20, i*20,255));
layer->setContentSize(CCSizeMake(i*100, i*100));
layer->setPosition(ccp(size.width/2, size.height/2));
layer->setAnchorPoint(ccp(0.5f, 0.5f));
layer->setIsRelativeAnchorPoint(true);
addChild(layer, -1-i);
}
// create and initialize a Label
CCLabelTTF *label = CCLabelTTF::create("Hello World", "Marker Felt", 64);
CCMenuItem *item1 = CCMenuItemFont::create("restart", this, menu_selector(Bug914Layer::restart));
CCMenu *menu = CCMenu::create(item1, NULL);
menu->alignItemsVertically();
menu->setPosition(ccp(size.width/2, 100));
addChild(menu);
// position the label on the center of the screen
label->setPosition(ccp( size.width /2 , size.height/2 ));
// add the label as a child to this Layer
addChild(label);
return true;
}
return false;
}