当前位置: 首页>>代码示例>>C++>>正文


C++ MainMenu::setPosition方法代码示例

本文整理汇总了C++中MainMenu::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ MainMenu::setPosition方法的具体用法?C++ MainMenu::setPosition怎么用?C++ MainMenu::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainMenu的用法示例。


在下文中一共展示了MainMenu::setPosition方法的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;
}
开发者ID:zlm731,项目名称:ibubblebreaker,代码行数:86,代码来源:HelloWorldScene.cpp


注:本文中的MainMenu::setPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。