COCOS2D-X UI组件

cocos2d-x-extensions

https://github.com/jandujar/cocos2d-x-extensions

https://github.com/dualface/cocos2d-x-extensions

https://github.com/darkfall/cocos2dx-extensions


水果忍者-by Cocos2d-X

刀光效果
http://www.cocoachina.com/bbs/read.php?tid=98115&page=1

AngryBird Space失重特效

http://www.cocoachina.com/bbs/read.php?tid=98045

有没有一个CCTab的控件?

https://github.com/simdm/cocos2d-x-extensions-1/tree/master/extensions/CCTabView


多语言解决方案,

1.解析XML

http://codingnow.cn/cocos2d-x/1038.html

2.解析KEY = VALUE 键值对

https://github.com/sue602/CCLocalizedStringDemo

个人倾向于第二种方式。


CCMenu

// 创建

[cpp]  view plain copy
  1. // add menu items for tests  
  2. CCMenu *m_pItemMenu = CCMenu::create();  
  3. for (int i = 0; i < MENU_COUNT; ++i)  
  4. {  
  5.     CCLabelTTF* label = CCLabelTTF::create(TITLES[i].c_str(), "Arial", 24);       
  6.     CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TestMenuScene::menuCallback));  
  7.   
  8.     m_pItemMenu->addChild(pMenuItem, i + 10000);  
  9.     pMenuItem->setPosition( ccp( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) ));  
  10. }  
  11.   
  12. m_pItemMenu->setContentSize(CCSizeMake(VisibleRect::getVisibleRect().size.width, (MENU_COUNT + 1) * (LINE_SPACE)));  
  13. m_pItemMenu->setPosition(CCPointMake(0,0));  
  14. addChild(m_pItemMenu);  

// 回调

[cpp]  view plain copy
  1. void TestMenuScene::menuCallback(CCObject * pSender)  
  2. {  
  3.     CCLOG("menuCallback");  
  4.   
  5.     // get the userdata, it's the index of the menu item clicked  
  6.     CCMenuItem* pMenuItem = (CCMenuItem *)(pSender);  
  7.     int nIdx = pMenuItem->getZOrder() - 10000;  
  8.   
  9.     // create the test scene and run it  
  10.     CCScene* pScene = CreateScene(nIdx);  
  11.     CCDirector *pDirector = CCDirector::sharedDirector();  
  12.     if (pScene)  
  13.     {  
  14.         pDirector->replaceScene(pScene);  
  15.     }  
  16. }  

SlidingMenu

滑动菜单
http://www.cocos2d-x.org/boards/18/topics/9931
https://github.com/prsolucoes/cocos2d-x

CCTableView

// 创建

http://space.itpub.net/14466241/viewspace-751173

下一个版本新加了选中效果

Q:

1.如何实现多行多列

2.cell间间隙很大的

3.

多行多列:

http://www.cocos2d-x.org/boards/18/topics/15777

CCControlButton

// 创建

[cpp]  view plain copy
  1. CCControlButton *btn = CCControlButton::create(titles[i], "Helvetica", 30);  
  2. btn->setBackgroundSpriteFrameForState(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("anniu5.png"), CCControlStateNormal);  
  3. btn->setBackgroundSpriteFrameForState(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("anniu5_press.png"), CCControlStateHighlighted);  
  4. btn->setPosition(ccp(140, 647 + i * -71));  
  5. btn->setPreferredSize(CCSizeMake(196, 60));  
  6. btn->setTitleColorForState(ccGRAY, CCControlStateNormal);  
  7. btn->setTitleColorForState(ccGREEN, CCControlStateHighlighted);  
  8. btn->addTargetWithActionForControlEvents(this, cccontrol_selector(ShopScene::touchUpInsideAction),CCControlEventTouchUpInside);  
  9. btn->setTag(i);  
  10. addChild(btn);  

// 回调

[cpp]  view plain copy
  1. void ShopScene::touchUpInsideAction(CCObject* pSender, CCControlEvent event)  
  2. {  
  3.     int tag = ((CCNode *)pSender)->getTag();  
  4.     CCLOG("touchUpInsideAction:%d", tag);  
  5. }  

你可能感兴趣的:(cocos2d-x)