diff --git a/CHANGELOG b/CHANGELOG index 4002d73d77..9584fc46ef 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +cocos2d-x-3.0alpha0-pre @Jul.24 2013 +[all platforms] + Feature #XXXX: Add support for std::function<> in CCMemuItem and CCCallFunc + + cocos2d-2.1rc0-x-2.1.3 @May.01 2013 [all platforms] Bug #1853: use SHELLOPTS instead of "-o igncr" for Android Eclipse project diff --git a/cocos2dx/cocos2d.cpp b/cocos2dx/cocos2d.cpp index 2a8e582497..d109164fe1 100644 --- a/cocos2dx/cocos2d.cpp +++ b/cocos2dx/cocos2d.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN const char* cocos2dVersion() { - return "2.1rc0-x-2.1.3"; + return "3.0-alpha0-pre"; } NS_CC_END diff --git a/cocos2dx/menu_nodes/CCMenuItem.cpp b/cocos2dx/menu_nodes/CCMenuItem.cpp index c828c62a8a..fbdb834dc0 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.cpp +++ b/cocos2dx/menu_nodes/CCMenuItem.cpp @@ -161,6 +161,7 @@ bool CCMenuItem::isSelected() return m_bSelected; } +// XXX deprecated void CCMenuItem::setTarget(CCObject *target, SEL_MenuHandler selector) { _target = target; @@ -432,6 +433,7 @@ CCMenuItemFont * CCMenuItemFont::create(const char *value) return pRet; } +// XXX: deprecated bool CCMenuItemFont::initWithString(const char *value, CCObject* target, SEL_MenuHandler selector) { CCAssert( value != NULL && strlen(value) != 0, "Value length must be greater than 0"); @@ -846,6 +848,7 @@ CCArray* CCMenuItemToggle::getSubItems() return m_pSubItems; } +// XXX: deprecated CCMenuItemToggle * CCMenuItemToggle::createWithTarget(CCObject* target, SEL_MenuHandler selector, CCArray* menuItems) { CCMenuItemToggle *pRet = new CCMenuItemToggle(); @@ -864,6 +867,25 @@ CCMenuItemToggle * CCMenuItemToggle::createWithTarget(CCObject* target, SEL_Menu return pRet; } +CCMenuItemToggle * CCMenuItemToggle::createWithCallback(const ccMenuCallback &callback, CCArray* menuItems) +{ + CCMenuItemToggle *pRet = new CCMenuItemToggle(); + pRet->CCMenuItem::initWithCallback(callback); + pRet->m_pSubItems = CCArray::create(); + pRet->m_pSubItems->retain(); + + for (unsigned int z=0; z < menuItems->count(); z++) + { + CCMenuItem* menuItem = (CCMenuItem*)menuItems->objectAtIndex(z); + pRet->m_pSubItems->addObject(menuItem); + } + + pRet->m_uSelectedIndex = UINT_MAX; + pRet->setSelectedIndex(0); + return pRet; +} + +// XXX: deprecated CCMenuItemToggle * CCMenuItemToggle::createWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...) { va_list args; @@ -875,6 +897,17 @@ CCMenuItemToggle * CCMenuItemToggle::createWithTarget(CCObject* target, SEL_Menu return pRet; } +CCMenuItemToggle * CCMenuItemToggle::createWithCallback(const ccMenuCallback &callback, CCMenuItem* item, ...) +{ + va_list args; + va_start(args, item); + CCMenuItemToggle *pRet = new CCMenuItemToggle(); + pRet->initWithCallback(callback, item, args); + pRet->autorelease(); + va_end(args); + return pRet; +} + CCMenuItemToggle * CCMenuItemToggle::create() { CCMenuItemToggle *pRet = new CCMenuItemToggle(); @@ -883,14 +916,22 @@ CCMenuItemToggle * CCMenuItemToggle::create() return pRet; } +// XXX: deprecated bool CCMenuItemToggle::initWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, va_list args) { - CCMenuItem::initWithTarget(target, selector); + _target = target; + CC_SAFE_RETAIN(_target); + return initWithCallback(std::bind( selector, target, std::placeholders::_1), item, args); +} + +bool CCMenuItemToggle::initWithCallback(const ccMenuCallback &callback, CCMenuItem *item, va_list args) +{ + CCMenuItem::initWithCallback(callback); this->m_pSubItems = CCArray::create(); this->m_pSubItems->retain(); int z = 0; CCMenuItem *i = item; - while(i) + while(i) { z++; m_pSubItems->addObject(i); diff --git a/cocos2dx/menu_nodes/CCMenuItem.h b/cocos2dx/menu_nodes/CCMenuItem.h index ca34e8d08c..2e8b2e8d4c 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.h +++ b/cocos2dx/menu_nodes/CCMenuItem.h @@ -374,12 +374,12 @@ public: /** creates a menu item from a CCArray with a target selector */ CC_DEPRECATED_ATTRIBUTE static CCMenuItemToggle * createWithTarget(CCObject* target, SEL_MenuHandler selector, CCArray* menuItems); /** creates a menu item from a CCArray with a callable object */ - static CCMenuItemToggle * createWithTarget(const ccMenuCallback& callback, CCArray* menuItems); + static CCMenuItemToggle * createWithCallback(const ccMenuCallback& callback, CCArray* menuItems); /** creates a menu item from a list of items with a target/selector */ CC_DEPRECATED_ATTRIBUTE static CCMenuItemToggle* createWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, ...); /** creates a menu item from a list of items with a callable object */ - static CCMenuItemToggle* createWithTarget(const ccMenuCallback& callback, CCMenuItem* item, ...); + static CCMenuItemToggle* createWithCallback(const ccMenuCallback& callback, CCMenuItem* item, ...); /** creates a menu item with no target/selector and no items */ static CCMenuItemToggle* create(); @@ -387,7 +387,7 @@ public: /** initializes a menu item from a list of items with a target selector */ CC_DEPRECATED_ATTRIBUTE bool initWithTarget(CCObject* target, SEL_MenuHandler selector, CCMenuItem* item, va_list args); /** initializes a menu item from a list of items with a callable object */ - bool initWithTarget(const ccMenuCallback& callback, CCMenuItem* item, va_list args); + bool initWithCallback(const ccMenuCallback& callback, CCMenuItem* item, va_list args); /** creates a menu item with a item */ static CCMenuItemToggle* create(CCMenuItem *item); diff --git a/cocos2dx/platform/android/java/project.properties b/cocos2dx/platform/android/java/project.properties index 4a46b9d1c9..cd0ca122a3 100644 --- a/cocos2dx/platform/android/java/project.properties +++ b/cocos2dx/platform/android/java/project.properties @@ -12,4 +12,4 @@ android.library=true # Project target. -target=android-17 +target=android-8 diff --git a/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id b/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id index 4bb1923ca5..f27e968293 100644 --- a/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -125800bcfe2802d3c6a965a3aa337147d20bf187 \ No newline at end of file +5b8ea64c349dcc515312773df1d8d0d5d20abfbe \ No newline at end of file diff --git a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp index bd7e691357..3082d3dff1 100644 --- a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp +++ b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp @@ -34,42 +34,43 @@ MenuLayerMainMenu::MenuLayerMainMenu() CCSprite* spriteSelected = CCSprite::create(s_MenuItem, CCRectMake(0,23*1,115,23)); CCSprite* spriteDisabled = CCSprite::create(s_MenuItem, CCRectMake(0,23*0,115,23)); - CCMenuItemSprite* item1 = CCMenuItemSprite::create(spriteNormal, spriteSelected, spriteDisabled, this, menu_selector(MenuLayerMainMenu::menuCallback) ); + CCMenuItemSprite* item1 = CCMenuItemSprite::create(spriteNormal, spriteSelected, spriteDisabled, std::bind(&MenuLayerMainMenu::menuCallback, this, std::placeholders::_1) ); // Image Item - CCMenuItem* item2 = CCMenuItemImage::create(s_SendScore, s_PressSendScore, this, menu_selector(MenuLayerMainMenu::menuCallback2) ); + CCMenuItem* item2 = CCMenuItemImage::create(s_SendScore, s_PressSendScore, std::bind(&MenuLayerMainMenu::menuCallback2, this, std::placeholders::_1) ); // Label Item (LabelAtlas) CCLabelAtlas* labelAtlas = CCLabelAtlas::create("0123456789", "fonts/labelatlas.png", 16, 24, '.'); - CCMenuItemLabel* item3 = CCMenuItemLabel::create(labelAtlas, this, menu_selector(MenuLayerMainMenu::menuCallbackDisabled) ); + CCMenuItemLabel* item3 = CCMenuItemLabel::create(labelAtlas, std::bind(&MenuLayerMainMenu::menuCallbackDisabled, this, std::placeholders::_1) ); item3->setDisabledColor( ccc3(32,32,64) ); item3->setColor( ccc3(200,200,255) ); // Font Item - CCMenuItemFont *item4 = CCMenuItemFont::create("I toggle enable items", this, menu_selector(MenuLayerMainMenu::menuCallbackEnable) ); + CCMenuItemFont *item4 = CCMenuItemFont::create("I toggle enable items", [&](CCObject *sender) { + m_disabledItem->setEnabled(! m_disabledItem->isEnabled() ); + }); item4->setFontSizeObj(20); item4->setFontName("Marker Felt"); // Label Item (CCLabelBMFont) CCLabelBMFont* label = CCLabelBMFont::create("configuration", "fonts/bitmapFontTest3.fnt"); - CCMenuItemLabel* item5 = CCMenuItemLabel::create(label, this, menu_selector(MenuLayerMainMenu::menuCallbackConfig)); + CCMenuItemLabel* item5 = CCMenuItemLabel::create(label, std::bind(&MenuLayerMainMenu::menuCallbackConfig, this, std::placeholders::_1)); // Testing issue #500 item5->setScale( 0.8f ); // Events CCMenuItemFont::setFontName("Marker Felt"); - CCMenuItemFont *item6 = CCMenuItemFont::create("Priority Test", this, menu_selector(MenuLayerMainMenu::menuCallbackPriorityTest)); + CCMenuItemFont *item6 = CCMenuItemFont::create("Priority Test", std::bind(&MenuLayerMainMenu::menuCallbackPriorityTest, this, std::placeholders::_1)); // Bugs Item - CCMenuItemFont *item7 = CCMenuItemFont::create("Bugs", this, menu_selector(MenuLayerMainMenu::menuCallbackBugsTest)); + CCMenuItemFont *item7 = CCMenuItemFont::create("Bugs", std::bind(&MenuLayerMainMenu::menuCallbackBugsTest, this, std::placeholders::_1)); // Font Item - CCMenuItemFont* item8 = CCMenuItemFont::create("Quit", this, menu_selector(MenuLayerMainMenu::onQuit)); + CCMenuItemFont* item8 = CCMenuItemFont::create("Quit", std::bind(&MenuLayerMainMenu::onQuit, this, std::placeholders::_1)); - CCMenuItemFont* item9 = CCMenuItemFont::create("Remove menu item when moving", this, - menu_selector(MenuLayerMainMenu::menuMovingCallback)); + CCMenuItemFont* item9 = CCMenuItemFont::create("Remove menu item when moving", std::bind(&MenuLayerMainMenu::menuMovingCallback, this, std::placeholders::_1)); CCActionInterval* color_action = CCTintBy::create(0.5f, 0, -255, -255); CCActionInterval* color_back = color_action->reverse(); @@ -162,11 +163,6 @@ void MenuLayerMainMenu::menuCallbackDisabled(CCObject* sender) CCLog("TOUCHES DISABLED FOR 5 SECONDS"); } -void MenuLayerMainMenu::menuCallbackEnable(CCObject* sender) -{ - m_disabledItem->setEnabled(! m_disabledItem->isEnabled() ); -} - void MenuLayerMainMenu::menuCallback2(CCObject* sender) { ((CCLayerMultiplex*)m_pParent)->switchTo(2); @@ -202,9 +198,9 @@ MenuLayer2::MenuLayer2() { for( int i=0;i < 2;i++ ) { - CCMenuItemImage* item1 = CCMenuItemImage::create(s_PlayNormal, s_PlaySelect, this, menu_selector(MenuLayer2::menuCallback)); - CCMenuItemImage* item2 = CCMenuItemImage::create(s_HighNormal, s_HighSelect, this, menu_selector(MenuLayer2::menuCallbackOpacity) ); - CCMenuItemImage* item3 = CCMenuItemImage::create(s_AboutNormal, s_AboutSelect, this, menu_selector(MenuLayer2::menuCallbackAlign) ); + CCMenuItemImage* item1 = CCMenuItemImage::create(s_PlayNormal, s_PlaySelect, std::bind( &MenuLayer2::menuCallback, this, std::placeholders::_1)); + CCMenuItemImage* item2 = CCMenuItemImage::create(s_HighNormal, s_HighSelect, std::bind( &MenuLayer2::menuCallbackOpacity, this, std::placeholders::_1)); + CCMenuItemImage* item3 = CCMenuItemImage::create(s_AboutNormal, s_AboutSelect, std::bind( &MenuLayer2::menuCallbackAlign, this, std::placeholders::_1)); item1->setScaleX( 1.5f ); item2->setScaleX( 0.5f ); @@ -313,15 +309,23 @@ MenuLayer3::MenuLayer3() CCMenuItemFont::setFontSize(28); CCLabelBMFont* label = CCLabelBMFont::create("Enable AtlasItem", "fonts/bitmapFontTest3.fnt"); - CCMenuItemLabel* item1 = CCMenuItemLabel::create(label, this, menu_selector(MenuLayer3::menuCallback2) ); - CCMenuItemFont* item2 = CCMenuItemFont::create("--- Go Back ---", this, menu_selector(MenuLayer3::menuCallback) ); - + CCMenuItemLabel* item1 = CCMenuItemLabel::create(label, [&](CCObject *sender) { + //CCLOG("Label clicked. Toogling AtlasSprite"); + m_disabledItem->setEnabled( ! m_disabledItem->isEnabled() ); + m_disabledItem->stopAllActions(); + }); + CCMenuItemFont* item2 = CCMenuItemFont::create("--- Go Back ---", [&](CCObject *sender) { + ((CCLayerMultiplex*)m_pParent)->switchTo(0); + }); + CCSprite *spriteNormal = CCSprite::create(s_MenuItem, CCRectMake(0,23*2,115,23)); CCSprite *spriteSelected = CCSprite::create(s_MenuItem, CCRectMake(0,23*1,115,23)); CCSprite *spriteDisabled = CCSprite::create(s_MenuItem, CCRectMake(0,23*0,115,23)); - CCMenuItemSprite* item3 = CCMenuItemSprite::create(spriteNormal, spriteSelected, spriteDisabled, this, menu_selector(MenuLayer3::menuCallback3)); + CCMenuItemSprite* item3 = CCMenuItemSprite::create(spriteNormal, spriteSelected, spriteDisabled, [](CCObject *sender) { + CCLog("sprite clicked!"); + }); m_disabledItem = item3; item3->retain(); m_disabledItem->setEnabled( false ); @@ -355,23 +359,6 @@ MenuLayer3::~MenuLayer3() m_disabledItem->release(); } -void MenuLayer3::menuCallback(CCObject* sender) -{ - ((CCLayerMultiplex*)m_pParent)->switchTo(0); -} - -void MenuLayer3::menuCallback2(CCObject* sender) -{ - //CCLOG("Label clicked. Toogling AtlasSprite"); - m_disabledItem->setEnabled( ! m_disabledItem->isEnabled() ); - m_disabledItem->stopAllActions(); -} - -void MenuLayer3::menuCallback3(CCObject* sender) -{ - //CCLOG("MenuItemSprite clicked"); -} - //------------------------------------------------------------------ // // MenuLayer4 @@ -385,8 +372,7 @@ MenuLayer4::MenuLayer4() title1->setEnabled(false); CCMenuItemFont::setFontName( "Marker Felt" ); CCMenuItemFont::setFontSize(34); - CCMenuItemToggle* item1 = CCMenuItemToggle::createWithTarget(this, - menu_selector(MenuLayer4::menuCallback), + CCMenuItemToggle* item1 = CCMenuItemToggle::createWithCallback( std::bind( &MenuLayer4::menuCallback, this, std::placeholders::_1), CCMenuItemFont::create( "On" ), CCMenuItemFont::create( "Off"), NULL ); @@ -397,8 +383,7 @@ MenuLayer4::MenuLayer4() title2->setEnabled(false); CCMenuItemFont::setFontName( "Marker Felt" ); CCMenuItemFont::setFontSize(34); - CCMenuItemToggle *item2 = CCMenuItemToggle::createWithTarget(this, - menu_selector(MenuLayer4::menuCallback), + CCMenuItemToggle *item2 = CCMenuItemToggle::createWithCallback(std::bind( &MenuLayer4::menuCallback, this, std::placeholders::_1), CCMenuItemFont::create( "On" ), CCMenuItemFont::create( "Off"), NULL ); @@ -409,8 +394,7 @@ MenuLayer4::MenuLayer4() title3->setEnabled( false ); CCMenuItemFont::setFontName( "Marker Felt" ); CCMenuItemFont::setFontSize(34); - CCMenuItemToggle *item3 = CCMenuItemToggle::createWithTarget(this, - menu_selector(MenuLayer4::menuCallback), + CCMenuItemToggle *item3 = CCMenuItemToggle::createWithCallback(std::bind( &MenuLayer4::menuCallback, this, std::placeholders::_1), CCMenuItemFont::create( "High" ), CCMenuItemFont::create( "Low" ), NULL ); @@ -421,8 +405,7 @@ MenuLayer4::MenuLayer4() title4->setEnabled(false); CCMenuItemFont::setFontName( "Marker Felt" ); CCMenuItemFont::setFontSize(34); - CCMenuItemToggle *item4 = CCMenuItemToggle::createWithTarget(this, - menu_selector(MenuLayer4::menuCallback), + CCMenuItemToggle *item4 = CCMenuItemToggle::createWithCallback(std::bind( &MenuLayer4::menuCallback, this, std::placeholders::_1), CCMenuItemFont::create( "Off" ), NULL ); @@ -443,7 +426,7 @@ MenuLayer4::MenuLayer4() CCMenuItemFont::setFontSize( 34 ); CCLabelBMFont *label = CCLabelBMFont::create( "go back", "fonts/bitmapFontTest3.fnt" ); - CCMenuItemLabel* back = CCMenuItemLabel::create(label, this, menu_selector(MenuLayer4::backCallback) ); + CCMenuItemLabel* back = CCMenuItemLabel::create(label, std::bind( &MenuLayer4::backCallback, this, std::placeholders::_1) ); CCMenu *menu = CCMenu::create( title1, title2, @@ -484,8 +467,16 @@ MenuLayerPriorityTest::MenuLayerPriorityTest() // Menu 1 CCMenuItemFont::setFontName("Marker Felt"); CCMenuItemFont::setFontSize(18); - CCMenuItemFont *item1 = CCMenuItemFont::create("Return to Main Menu", this, menu_selector(MenuLayerPriorityTest::menuCallback)); - CCMenuItemFont *item2 = CCMenuItemFont::create("Disable menu for 5 seconds", this, menu_selector(MenuLayerPriorityTest::disableMenuCallback)); + CCMenuItemFont *item1 = CCMenuItemFont::create("Return to Main Menu", std::bind( &MenuLayerPriorityTest::menuCallback, this, std::placeholders::_1)); + CCMenuItemFont *item2 = CCMenuItemFont::create("Disable menu for 5 seconds", [&](CCObject *sender) { + m_pMenu1->setEnabled(false); + CCDelayTime *wait = CCDelayTime::create(5); + CCCallFunc *enable = CCCallFunc::create( [&]() { + m_pMenu1->setEnabled(true); + }); + CCSequence* seq = CCSequence::create(wait, enable, NULL); + m_pMenu1->runAction(seq); + }); m_pMenu1->addChild(item1); @@ -498,7 +489,16 @@ MenuLayerPriorityTest::MenuLayerPriorityTest() // Menu 2 m_bPriority = true; CCMenuItemFont::setFontSize(48); - item1 = CCMenuItemFont::create("Toggle priority", this, menu_selector(MenuLayerPriorityTest::togglePriorityCallback)); + item1 = CCMenuItemFont::create("Toggle priority", [&](CCObject *sender) { + if( m_bPriority) { + m_pMenu2->setHandlerPriority(kCCMenuHandlerPriority + 20); + m_bPriority = false; + } else { + m_pMenu2->setHandlerPriority(kCCMenuHandlerPriority - 20); + m_bPriority = true; + } + }); + item1->setColor(ccc3(0,0,255)); m_pMenu2->addChild(item1); addChild(m_pMenu2); @@ -515,32 +515,6 @@ void MenuLayerPriorityTest::menuCallback(CCObject* pSender) // [[CCDirector sharedDirector] popScene]; } -void MenuLayerPriorityTest::disableMenuCallback(CCObject* pSender) -{ - m_pMenu1->setEnabled(false); - CCDelayTime *wait = CCDelayTime::create(5); - CCCallFunc *enable = CCCallFunc::create(this, callfunc_selector(MenuLayerPriorityTest::enableMenuCallback)); - - CCSequence* seq = CCSequence::create(wait, enable, NULL); - m_pMenu1->runAction(seq); -} - -void MenuLayerPriorityTest::enableMenuCallback() -{ - m_pMenu1->setEnabled(true); -} - -void MenuLayerPriorityTest::togglePriorityCallback(CCObject* pSender) -{ - if( m_bPriority) { - m_pMenu2->setHandlerPriority(kCCMenuHandlerPriority + 20); - m_bPriority = false; - } else { - m_pMenu2->setHandlerPriority(kCCMenuHandlerPriority - 20); - m_bPriority = true; - } -} - // BugsTest BugsTest::BugsTest() { diff --git a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.h b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.h index 38833c86ca..78132323b8 100644 --- a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.h +++ b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.h @@ -23,7 +23,6 @@ public: void menuCallback(CCObject* pSender); void menuCallbackConfig(CCObject* pSender); void menuCallbackDisabled(CCObject* pSender); - void menuCallbackEnable(CCObject* pSender); void menuCallback2(CCObject* pSender); void menuCallbackPriorityTest(CCObject* pSender); void menuCallbackBugsTest(CCObject *pSender); @@ -63,11 +62,6 @@ public: MenuLayer3(void); ~MenuLayer3(); -public: - void menuCallback(CCObject* pSender); - void menuCallback2(CCObject* pSender); - void menuCallback3(CCObject* pSender); - //CREATE_NODE(MenuLayer3); }; @@ -91,9 +85,6 @@ public: ~MenuLayerPriorityTest(); void menuCallback(CCObject* pSender); - void disableMenuCallback(CCObject* pSender); - void enableMenuCallback(); - void togglePriorityCallback(CCObject* pSender); private: CCMenu* m_pMenu1; CCMenu* m_pMenu2; diff --git a/samples/Cpp/TestCpp/Classes/controller.cpp b/samples/Cpp/TestCpp/Classes/controller.cpp index 86eda2c443..1c6294eb4c 100644 --- a/samples/Cpp/TestCpp/Classes/controller.cpp +++ b/samples/Cpp/TestCpp/Classes/controller.cpp @@ -104,7 +104,7 @@ TestController::TestController() // #else CCLabelTTF* label = CCLabelTTF::create( g_aTestNames[i].test_name, "Arial", 24); // #endif - CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, this, menu_selector(TestController::menuCallback)); + CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, std::bind(&TestController::menuCallback, this, std::placeholders::_1)); m_pItemMenu->addChild(pMenuItem, i + 10000); pMenuItem->setPosition( ccp( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) )); diff --git a/samples/Cpp/TestCpp/proj.android/project.properties b/samples/Cpp/TestCpp/proj.android/project.properties index b93e70be46..2482d70f38 100644 --- a/samples/Cpp/TestCpp/proj.android/project.properties +++ b/samples/Cpp/TestCpp/proj.android/project.properties @@ -8,6 +8,6 @@ # project structure. # Project target. -target=android-17 +target=android-8 android.library.reference.1=../../../../cocos2dx/platform/android/java diff --git a/tools/tojs/cocos2dx.ini b/tools/tojs/cocos2dx.ini index 4b47d76c41..8d1da651d5 100644 --- a/tools/tojs/cocos2dx.ini +++ b/tools/tojs/cocos2dx.ini @@ -47,7 +47,7 @@ skip = CCNode::[convertToWindowSpace ^setPosition$ getGrid setGLServerState desc CCDirector::[getAccelerometer getKeypadDispatcher getTouchDispatcher setWatcherCallbackFun getOpenGLView getProjection getClassTypeInfo], CCLayer.*::[didAccelerate (g|s)etBlendFunc], CCMenu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns], - CCMenuItem.*::[create setCallback], + CCMenuItem.*::[create setCallback initWithCallback], CCCopying::[*], CC.*Protocol::[*], CC.*Delegate::[*],