2013-07-29

CCSprite *achievementSprite=CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("achievement.png"));//成就
    CCSprite *activitySprite=CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("activity.png"));//活动
    CCSprite *bagSprite=CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("backPackage.png"));//背包
    CCSprite *heroSprite=CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("hero.png"));//武将
    CCSprite *upgradeSprite=CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("lvUp.png"));//升级
    CCSprite *markSprite=CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("mark.png"));//集市
    //
    CCMenuItemSprite* heroBtn=CCMenuItemSprite::create(heroSprite,NULL,NULL,this,menu_selector(MainLayer::openHero));
    CCMenuItemSprite* bagBtn=CCMenuItemSprite::create(bagSprite,NULL,NULL,this,menu_selector(MainLayer::openBag));
    CCMenuItemSprite* upgradeBtn=CCMenuItemSprite::create(upgradeSprite,NULL,NULL,this,menu_selector(MainLayer::openUpgrade));
    CCMenuItemSprite* markBtn=CCMenuItemSprite::create(markSprite,NULL,NULL,this,menu_selector(MainLayer::openMark));
    CCMenuItemSprite* achievementBtn=CCMenuItemSprite::create(achievementSprite,NULL,NULL,this,menu_selector(MainLayer::openAchievement));
    CCMenuItemSprite* activityBtn=CCMenuItemSprite::create(activitySprite,NULL,NULL,this,menu_selector(MainLayer::openActivity));
    //
    heroBtn->setAnchorPoint(ccp(0,1));
    bagBtn->setAnchorPoint(ccp(0,1));
    upgradeBtn->setAnchorPoint(ccp(0,1));
    markBtn->setAnchorPoint(ccp(0,1));
    achievementBtn->setAnchorPoint(ccp(0,1));
    activityBtn->setAnchorPoint(ccp(0,1));
    //
    CCMenu* menu0=CCMenu::create(heroBtn,upgradeBtn,achievementBtn,NULL);
    menu0->setPosition(ccp(63,winSize.height-440-117));
    menu0->alignItemsVerticallyWithPadding(26);
    addChild(menu0);

    CCMenu* menu1=CCMenu::create(bagBtn,markBtn,activityBtn,NULL);
    menu1->setPosition(ccp(363,winSize.height-440-117));
    menu1->alignItemsVerticallyWithPadding(26);
    addChild(menu1);

 

http://my.oschina.net/yunyu/blog/74296

http://www.cocos2d-x.org/projects/cocos2d-x/wiki/CCControlExtension

http://www.cnblogs.com/walzer/archive/2010/10/10/1847089.html

http://my.oschina.net/tangjl/blog/108797

http://blog.csdn.net/musicvs/article/details/8242963

http://www.firedragonpzy.com.cn/

http://blog.csdn.net/yanghuiliu/article/category/913515

 

http://blog.csdn.net/yanghuiliu/article/category/913515

http://blog.csdn.net/yanghuiliu/article/details/7693053

http://blog.csdn.net/xuguangsoft/article/details/8643131

cocos2d-x  控件

http://www.cocos2d-iphone.org/forums/topic/menu-alignitemsinrows-columns-question/

你可能感兴趣的:(2013-07-29)