本文整理汇总了C++中MainMenu::setAnchorPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ MainMenu::setAnchorPoint方法的具体用法?C++ MainMenu::setAnchorPoint怎么用?C++ MainMenu::setAnchorPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainMenu
的用法示例。
在下文中一共展示了MainMenu::setAnchorPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayerColor::init() )
{
return false;
}
LOCATE::init();
m_scene = SCENE_OPEN;
// set myself with color
CCSize WinSize = CCDirector::sharedDirector()->getWinSize();
initWithColor(ccc4(255, 255, 255, 255), WinSize.width, WinSize.height);
setPosition(ccp(0,0));
//++++++++++++++++ create title sprite
title *pTitle = title::create();
//CCSprite *pTitle = CCSprite::create("title.png");
//CCSize titlesize = pTitle->getContentSize();
pTitle->setAnchorPoint(ccp(0.5,0.5));
pTitle->setTag(TAG_TITLE);
addChild(pTitle);
pTitle->setPosition(titlepos(POS_OUT));
//+++++++++++++++++ create mainmenu
MainMenu *pMainmenu = MainMenu::create();
pMainmenu->setAnchorPoint(ccp(0.5,0.5));
pMainmenu->setTag(TAG_MAINMENU);
addChild(pMainmenu);
pMainmenu->setPosition(mainmenupos(POS_OUT));
//++++++++++++++++++ create gamelayer
GAMELAYER *pgame = GAMELAYER::create();
pgame->setAnchorPoint(ccp(0,0));
pgame->setTag(TAG_GAMELAYER);
addChild(pgame);
pgame->setPosition(gamelayerpos(POS_OUT));
//+++++++++++++++++++ create toolbar
ccColor4B c4b = getrandomcolor();
toolbar *pToolbar = toolbar::create();
CCAssert(pToolbar, "toolbar new fail");
pToolbar->setColor(ccc3(c4b.r, c4b.g, c4b.b));
pToolbar->setOpacity(128);
pToolbar->setContentSize(CCSize(WinSize.width, LO_TOOLBAR_H));
//pToolbar->setAnchorPoint(ccp(0,));
pToolbar->setTag(TAG_TOOLBAR);
addChild(pToolbar);
pToolbar->setPosition(toolbarpos(POS_OUT));
pToolbar->setAnchorPoint(ccp(0,0));
// +++++++++++++++++ create tops
tops *pTops = tops::create();
addChild(pTops);
pTops->setTag(TAG_TOPS);
pTops->setPosition(topspos(POS_OUT));
// ++++++++++++++++ create option
option *pOption = option::create();
addChild(pOption);
pOption->setTag(TAG_OPTION);
pOption->setPosition(optionpos(POS_OUT));
// +++++++++++++++++ create about
about *pAbout = about::create();
addChild(pAbout);
pAbout->setTag(TAG_ABOUT);
pAbout->setPosition(aboutpos(POS_OUT));
return true;
}