mirror of https://github.com/axmolengine/axmol.git
Adds CALLBACK_0, CALLBACK_1 and CALLBACK_2
Handy macros for callbacks. Instead of: std::bind(func_ptr, instnace, std::placeholder::_1) you use: CALLBACK_1(func_ptr, instance) And also removes more warnings from the tests
This commit is contained in:
parent
ef319da264
commit
83b43ab93e
|
@ -99,6 +99,11 @@ typedef int (CCObject::*SEL_Compare)(CCObject*);
|
|||
#define event_selector(_SELECTOR) (SEL_EventHandler)(&_SELECTOR)
|
||||
#define compare_selector(_SELECTOR) (SEL_Compare)(&_SELECTOR)
|
||||
|
||||
// new callbacks based on C++11
|
||||
#define CALLBACK_0(__selector__,__target__, ...) std::bind(&__selector__,__target__, ##__VA_ARGS__)
|
||||
#define CALLBACK_1(__selector__,__target__, ...) std::bind(&__selector__,__target__, std::placeholders::_1, ##__VA_ARGS__)
|
||||
#define CALLBACK_2(__selector__,__target__, ...) std::bind(&__selector__,__target__, std::placeholders::_1, std::placeholders::_2, ##__VA_ARGS__)
|
||||
|
||||
// end of base_nodes group
|
||||
/// @}
|
||||
|
||||
|
|
|
@ -295,8 +295,8 @@ void CCLayer::setKeyboardEnabled(bool enabled)
|
|||
CCDirector* pDirector = CCDirector::sharedDirector();
|
||||
if (enabled)
|
||||
{
|
||||
pDirector->getKeyboardDispatcher()->setKeyPressDelegate(std::bind(&CCLayer::keyPressed, this, std::placeholders::_1));
|
||||
pDirector->getKeyboardDispatcher()->setKeyReleaseDelegate(std::bind(&CCLayer::keyReleased, this, std::placeholders::_1));
|
||||
pDirector->getKeyboardDispatcher()->setKeyPressDelegate( CALLBACK_1(CCLayer::keyPressed, this) );
|
||||
pDirector->getKeyboardDispatcher()->setKeyReleaseDelegate( CALLBACK_1(CCLayer::keyReleased, this) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -11,7 +11,8 @@ void CCMenuItemLoader::onHandlePropTypeBlock(CCNode * pNode, CCNode * pParent, c
|
|||
if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) {
|
||||
if (NULL != pBlockData) // Add this condition to allow CCMenuItemImage without target/selector predefined
|
||||
{
|
||||
((CCMenuItem *)pNode)->setTarget(pBlockData->mTarget, pBlockData->mSELMenuHandler);
|
||||
((CCMenuItem *)pNode)->setCallback( std::bind( pBlockData->mSELMenuHandler, pBlockData->mTarget, std::placeholders::_1) );
|
||||
// ((CCMenuItem *)pNode)->setTarget(pBlockData->mTarget, pBlockData->mSELMenuHandler);
|
||||
}
|
||||
} else {
|
||||
CCNodeLoader::onHandlePropTypeBlock(pNode, pParent, pPropertyName, pBlockData, pCCBReader);
|
||||
|
|
|
@ -744,9 +744,10 @@ void ActionSequence2::onEnter()
|
|||
CCPlace::create(ccp(200,200)),
|
||||
CCShow::create(),
|
||||
CCMoveBy::create(1, ccp(100,0)),
|
||||
CCCallFunc::create(std::bind(&ActionSequence2::callback1,this)),
|
||||
CCCallFunc::create(std::bind(&ActionSequence2::callback2,this,m_grossini)),
|
||||
CCCallFunc::create(std::bind(&ActionSequence2::callback3,this,m_grossini,(void*)0xbebabeba)),
|
||||
// CALLBACK_0 == std::bind( &function, instance, ...)
|
||||
CCCallFunc::create( CALLBACK_0(ActionSequence2::callback1,this)),
|
||||
CCCallFunc::create( CALLBACK_0(ActionSequence2::callback2,this,m_grossini)),
|
||||
CCCallFunc::create( CALLBACK_0(ActionSequence2::callback3,this,m_grossini,(void*)0xbebabeba)),
|
||||
NULL);
|
||||
|
||||
m_grossini->runAction(action);
|
||||
|
|
|
@ -33,9 +33,10 @@ void BaseTest::onEnter()
|
|||
}
|
||||
|
||||
// add menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, std::bind( &BaseTest::backCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, std::bind( &BaseTest::restartCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, std::bind( &BaseTest::nextCallback, this, std::placeholders::_1) );
|
||||
// CALLBACK_1 == std::bind( function_ptr, instance, std::placeholders::_1, ...)
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, CALLBACK_1(BaseTest::backCallback, this) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, CALLBACK_1(BaseTest::restartCallback, this) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, CALLBACK_1(BaseTest::nextCallback, this) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -67,9 +67,9 @@ bool MenuLayer::initWithEntryID(int entryId)
|
|||
addChild(label, 1);
|
||||
label->setPosition( ccp(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height-50) );
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", std::bind( &MenuLayer::backCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png","Images/r2.png", std::bind( &MenuLayer::restartCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", std::bind( &MenuLayer::nextCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", CALLBACK_1(MenuLayer::backCallback, this) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png","Images/r2.png", CALLBACK_1( MenuLayer::restartCallback, this) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", CALLBACK_1(MenuLayer::nextCallback, this) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ bool Bug1159Layer::init()
|
|||
sprite_b->setPosition(ccp(s.width/2, s.height/2));
|
||||
addChild(sprite_b);
|
||||
|
||||
CCMenuItemLabel *label = CCMenuItemLabel::create(CCLabelTTF::create("Flip Me", "Helvetica", 24), std::bind( &Bug1159Layer::callBack, this, std::placeholders::_1) );
|
||||
CCMenuItemLabel *label = CCMenuItemLabel::create(CCLabelTTF::create("Flip Me", "Helvetica", 24), CALLBACK_1(Bug1159Layer::callBack, this) );
|
||||
CCMenu *menu = CCMenu::create(label, NULL);
|
||||
menu->setPosition(ccp(s.width - 200.0f, 50.0f));
|
||||
addChild(menu);
|
||||
|
|
|
@ -31,9 +31,9 @@ void Bug422Layer::reset()
|
|||
removeChild(node, false);
|
||||
// [self removeChildByTag:localtag-1 cleanup:NO];
|
||||
|
||||
CCMenuItem *item1 = CCMenuItemFont::create("One", std::bind( &Bug422Layer::menuCallback, this, std::placeholders::_1) );
|
||||
CCMenuItem *item1 = CCMenuItemFont::create("One", CALLBACK_1(Bug422Layer::menuCallback, this) );
|
||||
CCLog("MenuItemFont: %p", item1);
|
||||
CCMenuItem *item2 = CCMenuItemFont::create("Two", std::bind( &Bug422Layer::menuCallback, this, std::placeholders::_1) );
|
||||
CCMenuItem *item2 = CCMenuItemFont::create("Two", CALLBACK_1(Bug422Layer::menuCallback, this) );
|
||||
CCMenu *menu = CCMenu::create(item1, item2, NULL);
|
||||
menu->alignItemsVertically();
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ bool Bug458Layer::init()
|
|||
// [question setContentSize:CGSizeMake(50,50)];
|
||||
// [question2 setContentSize:CGSizeMake(50,50)];
|
||||
|
||||
CCMenuItemSprite* sprite = CCMenuItemSprite::create(question2, question, std::bind( &Bug458Layer::selectAnswer, this, std::placeholders::_1) );
|
||||
CCMenuItemSprite* sprite = CCMenuItemSprite::create(question2, question, CALLBACK_1(Bug458Layer::selectAnswer, this) );
|
||||
CCLayerColor* layer = CCLayerColor::create(ccc4(0,0,255,255), 100, 100);
|
||||
question->release();
|
||||
question2->release();
|
||||
|
||||
CCLayerColor* layer2 = CCLayerColor::create(ccc4(255,0,0,255), 100, 100);
|
||||
CCMenuItemSprite* sprite2 = CCMenuItemSprite::create(layer, layer2, std::bind( &Bug458Layer::selectAnswer, this, std::placeholders::_1) );
|
||||
CCMenuItemSprite* sprite2 = CCMenuItemSprite::create(layer, layer2, CALLBACK_1(Bug458Layer::selectAnswer, this) );
|
||||
CCMenu* menu = CCMenu::create(sprite, sprite2, NULL);
|
||||
menu->alignItemsVerticallyWithPadding(100);
|
||||
menu->setPosition(ccp(size.width / 2, size.height / 2));
|
||||
|
|
|
@ -46,7 +46,7 @@ bool Bug914Layer::init()
|
|||
|
||||
// create and initialize a Label
|
||||
CCLabelTTF *label = CCLabelTTF::create("Hello World", "Marker Felt", 64);
|
||||
CCMenuItem *item1 = CCMenuItemFont::create("restart", std::bind( &Bug914Layer::restart, this, std::placeholders::_1));
|
||||
CCMenuItem *item1 = CCMenuItemFont::create("restart", CALLBACK_1(Bug914Layer::restart, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, NULL);
|
||||
menu->alignItemsVertically();
|
||||
|
|
|
@ -117,7 +117,7 @@ void BugsTestBaseLayer::onEnter()
|
|||
|
||||
CCMenuItemFont::setFontName("Arial");
|
||||
CCMenuItemFont::setFontSize(24);
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", std::bind( &BugsTestBaseLayer::backCallback, this, std::placeholders::_1));
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", CALLBACK_1(BugsTestBaseLayer::backCallback, this));
|
||||
pMainItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu* pMenu = CCMenu::create(pMainItem, NULL);
|
||||
pMenu->setPosition( CCPointZero );
|
||||
|
|
|
@ -50,7 +50,7 @@ ChipmunkTestLayer::ChipmunkTestLayer()
|
|||
|
||||
// menu for debug layer
|
||||
CCMenuItemFont::setFontSize(18);
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toggle debug", std::bind( &ChipmunkTestLayer::toggleDebugCallback, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toggle debug", CALLBACK_1(ChipmunkTestLayer::toggleDebugCallback, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
this->addChild(menu);
|
||||
|
@ -147,7 +147,7 @@ void ChipmunkTestLayer::update(float delta)
|
|||
|
||||
void ChipmunkTestLayer::createResetButton()
|
||||
{
|
||||
CCMenuItemImage *reset = CCMenuItemImage::create("Images/r1.png", "Images/r2.png", std::bind( &ChipmunkTestLayer::reset, this, std::placeholders::_1));
|
||||
CCMenuItemImage *reset = CCMenuItemImage::create("Images/r1.png", "Images/r2.png", CALLBACK_1(ChipmunkTestLayer::reset, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(reset, NULL);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ m_nSoundId(0)
|
|||
//#else
|
||||
CCLabelTTF* label = CCLabelTTF::create(testItems[i].c_str(), "Arial", 24);
|
||||
//#endif
|
||||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, std::bind( &CocosDenshionTest::menuCallback, this, std::placeholders::_1));
|
||||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, CALLBACK_1(CocosDenshionTest::menuCallback, this));
|
||||
|
||||
m_pItmeMenu->addChild(pMenuItem, i + 10000);
|
||||
pMenuItem->setPosition( ccp( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) ));
|
||||
|
|
|
@ -42,7 +42,7 @@ bool CCControlScene::init()
|
|||
{
|
||||
if (CCLayer::init())
|
||||
{
|
||||
CCMenuItemFont* pBackItem = CCMenuItemFont::create("Back", std::bind( &CCControlScene::toExtensionsMainLayer, this, std::placeholders::_1));
|
||||
CCMenuItemFont* pBackItem = CCMenuItemFont::create("Back", CALLBACK_1(CCControlScene::toExtensionsMainLayer, this));
|
||||
pBackItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu* pBackMenu = CCMenu::create(pBackItem, NULL);
|
||||
pBackMenu->setPosition( CCPointZero );
|
||||
|
@ -65,9 +65,9 @@ bool CCControlScene::init()
|
|||
addChild(m_pSceneTitleLabel, 1);
|
||||
|
||||
// Add the menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", std::bind( &CCControlScene::previousCallback, this, std::placeholders::_1));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png", "Images/r2.png", std::bind( &CCControlScene::restartCallback, this, std::placeholders::_1));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", std::bind( &CCControlScene::nextCallback, this, std::placeholders::_1));
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", CALLBACK_1(CCControlScene::previousCallback, this));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png", "Images/r2.png", CALLBACK_1(CCControlScene::restartCallback, this));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", CALLBACK_1(CCControlScene::nextCallback, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item3, item2, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
|
|
|
@ -27,7 +27,7 @@ EditBoxTest::EditBoxTest()
|
|||
addChild(m_pTTFShowEditReturn);
|
||||
|
||||
// Back Menu
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", std::bind( &EditBoxTest::toExtensionsMainLayer, this, std::placeholders::_1));
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", CALLBACK_1(EditBoxTest::toExtensionsMainLayer, this));
|
||||
itemBack->setPosition(ccp(visibleOrigin.x+visibleSize.width - 50, visibleOrigin.y+25));
|
||||
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
|
||||
menuBack->setPosition(CCPointZero);
|
||||
|
|
|
@ -23,31 +23,31 @@ HttpClientTest::HttpClientTest()
|
|||
|
||||
// Get
|
||||
CCLabelTTF *labelGet = CCLabelTTF::create("Test Get", "Arial", 22);
|
||||
CCMenuItemLabel *itemGet = CCMenuItemLabel::create(labelGet, std::bind( &HttpClientTest::onMenuGetTestClicked, this, std::placeholders::_1));
|
||||
CCMenuItemLabel *itemGet = CCMenuItemLabel::create(labelGet, CALLBACK_1(HttpClientTest::onMenuGetTestClicked, this));
|
||||
itemGet->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - SPACE));
|
||||
menuRequest->addChild(itemGet);
|
||||
|
||||
// Post
|
||||
CCLabelTTF *labelPost = CCLabelTTF::create("Test Post", "Arial", 22);
|
||||
CCMenuItemLabel *itemPost = CCMenuItemLabel::create(labelPost, std::bind( &HttpClientTest::onMenuPostTestClicked, this, std::placeholders::_1));
|
||||
CCMenuItemLabel *itemPost = CCMenuItemLabel::create(labelPost, CALLBACK_1(HttpClientTest::onMenuPostTestClicked, this));
|
||||
itemPost->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - 2 * SPACE));
|
||||
menuRequest->addChild(itemPost);
|
||||
|
||||
// Post Binary
|
||||
CCLabelTTF *labelPostBinary = CCLabelTTF::create("Test Post Binary", "Arial", 22);
|
||||
CCMenuItemLabel *itemPostBinary = CCMenuItemLabel::create(labelPostBinary, std::bind( &HttpClientTest::onMenuPostBinaryTestClicked, this, std::placeholders::_1));
|
||||
CCMenuItemLabel *itemPostBinary = CCMenuItemLabel::create(labelPostBinary, CALLBACK_1(HttpClientTest::onMenuPostBinaryTestClicked, this));
|
||||
itemPostBinary->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - 3 * SPACE));
|
||||
menuRequest->addChild(itemPostBinary);
|
||||
|
||||
// Put
|
||||
CCLabelTTF *labelPut = CCLabelTTF::create("Test Put", "Arial", 22);
|
||||
CCMenuItemLabel *itemPut = CCMenuItemLabel::create(labelPut, std::bind( &HttpClientTest::onMenuPutTestClicked, this, std::placeholders::_1));
|
||||
CCMenuItemLabel *itemPut = CCMenuItemLabel::create(labelPut, CALLBACK_1(HttpClientTest::onMenuPutTestClicked, this));
|
||||
itemPut->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - 4 * SPACE));
|
||||
menuRequest->addChild(itemPut);
|
||||
|
||||
// Delete
|
||||
CCLabelTTF *labelDelete = CCLabelTTF::create("Test Delete", "Arial", 22);
|
||||
CCMenuItemLabel *itemDelete = CCMenuItemLabel::create(labelDelete, std::bind( &HttpClientTest::onMenuDeleteTestClicked, this, std::placeholders::_1));
|
||||
CCMenuItemLabel *itemDelete = CCMenuItemLabel::create(labelDelete, CALLBACK_1(HttpClientTest::onMenuDeleteTestClicked, this));
|
||||
itemDelete->setPosition(ccp(winSize.width / 2, winSize.height - MARGIN - 5 * SPACE));
|
||||
menuRequest->addChild(itemDelete);
|
||||
|
||||
|
@ -57,7 +57,7 @@ HttpClientTest::HttpClientTest()
|
|||
addChild(m_labelStatusCode);
|
||||
|
||||
// Back Menu
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", std::bind( &HttpClientTest::toExtensionsMainLayer, this, std::placeholders::_1));
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", CALLBACK_1(HttpClientTest::toExtensionsMainLayer, this));
|
||||
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
|
||||
menuBack->setPosition(CCPointZero);
|
||||
|
|
|
@ -82,7 +82,7 @@ NotificationCenterTest::NotificationCenterTest()
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCMenuItemFont* pBackItem = CCMenuItemFont::create("Back", std::bind( &NotificationCenterTest::toExtensionsMainLayer, this, std::placeholders::_1));
|
||||
CCMenuItemFont* pBackItem = CCMenuItemFont::create("Back", CALLBACK_1(NotificationCenterTest::toExtensionsMainLayer, this));
|
||||
pBackItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu* pBackMenu = CCMenu::create(pBackItem, NULL);
|
||||
pBackMenu->setPosition( CCPointZero );
|
||||
|
@ -92,7 +92,7 @@ NotificationCenterTest::NotificationCenterTest()
|
|||
CCLabelTTF *label2 = CCLabelTTF::create("switch on", "Marker Felt", 26);
|
||||
CCMenuItemLabel *item1 = CCMenuItemLabel::create(label1);
|
||||
CCMenuItemLabel *item2 = CCMenuItemLabel::create(label2);
|
||||
CCMenuItemToggle *item = CCMenuItemToggle::createWithCallback( std::bind( &NotificationCenterTest::toggleSwitch, this, std::placeholders::_1), item1, item2, NULL);
|
||||
CCMenuItemToggle *item = CCMenuItemToggle::createWithCallback( CALLBACK_1(NotificationCenterTest::toggleSwitch, this), item1, item2, NULL);
|
||||
// turn on
|
||||
item->setSelectedIndex(1);
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
|
@ -114,7 +114,7 @@ NotificationCenterTest::NotificationCenterTest()
|
|||
CCLabelTTF *label2 = CCLabelTTF::create("connected", "Marker Felt", 26);
|
||||
CCMenuItemLabel *item1 = CCMenuItemLabel::create(label1);
|
||||
CCMenuItemLabel *item2 = CCMenuItemLabel::create(label2);
|
||||
CCMenuItemToggle *item = CCMenuItemToggle::createWithCallback( std::bind( &NotificationCenterTest::connectToSwitch, this, std::placeholders::_1), item1, item2, NULL);
|
||||
CCMenuItemToggle *item = CCMenuItemToggle::createWithCallback( CALLBACK_1(NotificationCenterTest::connectToSwitch, this), item1, item2, NULL);
|
||||
item->setTag(kTagConnect+i);
|
||||
item->setPosition(ccp(light->getPosition().x, light->getPosition().y+50));
|
||||
menuConnect->addChild(item, 0);
|
||||
|
|
|
@ -39,7 +39,7 @@ bool TableViewTestLayer::init()
|
|||
tableView->reloadData();
|
||||
|
||||
// Back Menu
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", std::bind( &TableViewTestLayer::toExtensionsMainLayer, this, std::placeholders::_1));
|
||||
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", CALLBACK_1(TableViewTestLayer::toExtensionsMainLayer, this));
|
||||
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
|
||||
menuBack->setPosition(CCPointZero);
|
||||
|
|
|
@ -940,18 +940,18 @@ LabelTTFTest::LabelTTFTest()
|
|||
|
||||
CCMenuItemFont::setFontSize(30);
|
||||
CCMenu *menu = CCMenu::create(
|
||||
CCMenuItemFont::create("Left", std::bind( &LabelTTFTest::setAlignmentLeft, this, std::placeholders::_1)),
|
||||
CCMenuItemFont::create("Center", std::bind( &LabelTTFTest::setAlignmentCenter, this, std::placeholders::_1)),
|
||||
CCMenuItemFont::create("Right", std::bind( &LabelTTFTest::setAlignmentRight, this, std::placeholders::_1)),
|
||||
CCMenuItemFont::create("Left", CALLBACK_1(LabelTTFTest::setAlignmentLeft, this)),
|
||||
CCMenuItemFont::create("Center", CALLBACK_1(LabelTTFTest::setAlignmentCenter, this)),
|
||||
CCMenuItemFont::create("Right", CALLBACK_1(LabelTTFTest::setAlignmentRight, this)),
|
||||
NULL);
|
||||
menu->alignItemsVerticallyWithPadding(4);
|
||||
menu->setPosition(ccp(50, s.height / 2 - 20));
|
||||
this->addChild(menu);
|
||||
|
||||
menu = CCMenu::create(
|
||||
CCMenuItemFont::create("Top", std::bind( &LabelTTFTest::setAlignmentTop, this, std::placeholders::_1)),
|
||||
CCMenuItemFont::create("Middle", std::bind( &LabelTTFTest::setAlignmentMiddle, this, std::placeholders::_1)),
|
||||
CCMenuItemFont::create("Bottom", std::bind( &LabelTTFTest::setAlignmentBottom, this, std::placeholders::_1)),
|
||||
CCMenuItemFont::create("Top", CALLBACK_1(LabelTTFTest::setAlignmentTop, this)),
|
||||
CCMenuItemFont::create("Middle", CALLBACK_1(LabelTTFTest::setAlignmentMiddle, this)),
|
||||
CCMenuItemFont::create("Bottom", CALLBACK_1(LabelTTFTest::setAlignmentBottom, this)),
|
||||
NULL);
|
||||
menu->alignItemsVerticallyWithPadding(4);
|
||||
menu->setPosition(ccp(s.width - 50, s.height / 2 - 20));
|
||||
|
@ -1155,9 +1155,9 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment()
|
|||
this->m_pArrowsShouldRetain->retain();
|
||||
|
||||
CCMenuItemFont::setFontSize(20);
|
||||
CCMenuItemFont *longSentences = CCMenuItemFont::create("Long Flowing Sentences", std::bind( &BitmapFontMultiLineAlignment::stringChanged, this, std::placeholders::_1));
|
||||
CCMenuItemFont *lineBreaks = CCMenuItemFont::create("Short Sentences With Intentional Line Breaks", std::bind( &BitmapFontMultiLineAlignment::stringChanged, this, std::placeholders::_1));
|
||||
CCMenuItemFont *mixed = CCMenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", std::bind( &BitmapFontMultiLineAlignment::stringChanged, this, std::placeholders::_1));
|
||||
CCMenuItemFont *longSentences = CCMenuItemFont::create("Long Flowing Sentences", CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
|
||||
CCMenuItemFont *lineBreaks = CCMenuItemFont::create("Short Sentences With Intentional Line Breaks", CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
|
||||
CCMenuItemFont *mixed = CCMenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", CALLBACK_1(BitmapFontMultiLineAlignment::stringChanged, this));
|
||||
CCMenu *stringMenu = CCMenu::create(longSentences, lineBreaks, mixed, NULL);
|
||||
stringMenu->alignItemsVertically();
|
||||
|
||||
|
@ -1169,9 +1169,9 @@ BitmapFontMultiLineAlignment::BitmapFontMultiLineAlignment()
|
|||
|
||||
CCMenuItemFont::setFontSize(30);
|
||||
|
||||
CCMenuItemFont *left = CCMenuItemFont::create("Left", std::bind( &BitmapFontMultiLineAlignment::alignmentChanged, this, std::placeholders::_1));
|
||||
CCMenuItemFont *center = CCMenuItemFont::create("Center", std::bind( &BitmapFontMultiLineAlignment::alignmentChanged, this, std::placeholders::_1));
|
||||
CCMenuItemFont *right = CCMenuItemFont::create("Right", std::bind( &BitmapFontMultiLineAlignment::alignmentChanged, this, std::placeholders::_1));
|
||||
CCMenuItemFont *left = CCMenuItemFont::create("Left", CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
|
||||
CCMenuItemFont *center = CCMenuItemFont::create("Center", CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
|
||||
CCMenuItemFont *right = CCMenuItemFont::create("Right", CALLBACK_1(BitmapFontMultiLineAlignment::alignmentChanged, this));
|
||||
CCMenu *alignmentMenu = CCMenu::create(left, center, right, NULL);
|
||||
alignmentMenu->alignItemsHorizontallyWithPadding(alignmentItemPadding);
|
||||
|
||||
|
|
|
@ -595,7 +595,7 @@ LayerGradient::LayerGradient()
|
|||
CCLabelTTF *label2 = CCLabelTTF::create("Compressed Interpolation: Disabled", "Marker Felt", 26);
|
||||
CCMenuItemLabel *item1 = CCMenuItemLabel::create(label1);
|
||||
CCMenuItemLabel *item2 = CCMenuItemLabel::create(label2);
|
||||
CCMenuItemToggle *item = CCMenuItemToggle::createWithCallback( std::bind(&LayerGradient::toggleItem, this, std::placeholders::_1), item1, item2, NULL);
|
||||
CCMenuItemToggle *item = CCMenuItemToggle::createWithCallback( CALLBACK_1(LayerGradient::toggleItem, this), item1, item2, NULL);
|
||||
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
addChild(menu);
|
||||
|
@ -660,7 +660,7 @@ void LayerIgnoreAnchorPointPos::onEnter()
|
|||
CCSize lsize = l->getContentSize();
|
||||
child->setPosition(ccp(lsize.width/2, lsize.height/2));
|
||||
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toggle ignore anchor point", std::bind( &LayerIgnoreAnchorPointPos::onToggle, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toggle ignore anchor point", CALLBACK_1(LayerIgnoreAnchorPointPos::onToggle, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
this->addChild(menu);
|
||||
|
@ -708,7 +708,7 @@ void LayerIgnoreAnchorPointRot::onEnter()
|
|||
CCSize lsize = l->getContentSize();
|
||||
child->setPosition(ccp(lsize.width/2, lsize.height/2));
|
||||
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", std::bind( &LayerIgnoreAnchorPointRot::onToggle, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", CALLBACK_1(LayerIgnoreAnchorPointRot::onToggle, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
this->addChild(menu);
|
||||
|
@ -759,7 +759,7 @@ void LayerIgnoreAnchorPointScale::onEnter()
|
|||
CCSize lsize = l->getContentSize();
|
||||
child->setPosition(ccp(lsize.width/2, lsize.height/2));
|
||||
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", std::bind( &LayerIgnoreAnchorPointScale::onToggle, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toogle ignore anchor point", CALLBACK_1(LayerIgnoreAnchorPointScale::onToggle, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
this->addChild(menu);
|
||||
|
|
|
@ -34,14 +34,14 @@ 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, std::bind(&MenuLayerMainMenu::menuCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemSprite* item1 = CCMenuItemSprite::create(spriteNormal, spriteSelected, spriteDisabled, CALLBACK_1(MenuLayerMainMenu::menuCallback, this) );
|
||||
|
||||
// Image Item
|
||||
CCMenuItem* item2 = CCMenuItemImage::create(s_SendScore, s_PressSendScore, std::bind(&MenuLayerMainMenu::menuCallback2, this, std::placeholders::_1) );
|
||||
CCMenuItem* item2 = CCMenuItemImage::create(s_SendScore, s_PressSendScore, CALLBACK_1(MenuLayerMainMenu::menuCallback2, this) );
|
||||
|
||||
// Label Item (LabelAtlas)
|
||||
CCLabelAtlas* labelAtlas = CCLabelAtlas::create("0123456789", "fonts/labelatlas.png", 16, 24, '.');
|
||||
CCMenuItemLabel* item3 = CCMenuItemLabel::create(labelAtlas, std::bind(&MenuLayerMainMenu::menuCallbackDisabled, this, std::placeholders::_1) );
|
||||
CCMenuItemLabel* item3 = CCMenuItemLabel::create(labelAtlas, CALLBACK_1(MenuLayerMainMenu::menuCallbackDisabled, this) );
|
||||
item3->setDisabledColor( ccc3(32,32,64) );
|
||||
item3->setColor( ccc3(200,200,255) );
|
||||
|
||||
|
@ -55,22 +55,22 @@ MenuLayerMainMenu::MenuLayerMainMenu()
|
|||
|
||||
// Label Item (CCLabelBMFont)
|
||||
CCLabelBMFont* label = CCLabelBMFont::create("configuration", "fonts/bitmapFontTest3.fnt");
|
||||
CCMenuItemLabel* item5 = CCMenuItemLabel::create(label, std::bind(&MenuLayerMainMenu::menuCallbackConfig, this, std::placeholders::_1));
|
||||
CCMenuItemLabel* item5 = CCMenuItemLabel::create(label, CALLBACK_1(MenuLayerMainMenu::menuCallbackConfig, this));
|
||||
|
||||
// Testing issue #500
|
||||
item5->setScale( 0.8f );
|
||||
|
||||
// Events
|
||||
CCMenuItemFont::setFontName("Marker Felt");
|
||||
CCMenuItemFont *item6 = CCMenuItemFont::create("Priority Test", std::bind(&MenuLayerMainMenu::menuCallbackPriorityTest, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item6 = CCMenuItemFont::create("Priority Test", CALLBACK_1(MenuLayerMainMenu::menuCallbackPriorityTest, this));
|
||||
|
||||
// Bugs Item
|
||||
CCMenuItemFont *item7 = CCMenuItemFont::create("Bugs", std::bind(&MenuLayerMainMenu::menuCallbackBugsTest, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item7 = CCMenuItemFont::create("Bugs", CALLBACK_1(MenuLayerMainMenu::menuCallbackBugsTest, this));
|
||||
|
||||
// Font Item
|
||||
CCMenuItemFont* item8 = CCMenuItemFont::create("Quit", std::bind(&MenuLayerMainMenu::onQuit, this, std::placeholders::_1));
|
||||
CCMenuItemFont* item8 = CCMenuItemFont::create("Quit", CALLBACK_1(MenuLayerMainMenu::onQuit, this));
|
||||
|
||||
CCMenuItemFont* item9 = CCMenuItemFont::create("Remove menu item when moving", std::bind(&MenuLayerMainMenu::menuMovingCallback, this, std::placeholders::_1));
|
||||
CCMenuItemFont* item9 = CCMenuItemFont::create("Remove menu item when moving", CALLBACK_1(MenuLayerMainMenu::menuMovingCallback, this));
|
||||
|
||||
CCActionInterval* color_action = CCTintBy::create(0.5f, 0, -255, -255);
|
||||
CCActionInterval* color_back = color_action->reverse();
|
||||
|
@ -198,9 +198,9 @@ MenuLayer2::MenuLayer2()
|
|||
{
|
||||
for( int i=0;i < 2;i++ )
|
||||
{
|
||||
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));
|
||||
CCMenuItemImage* item1 = CCMenuItemImage::create(s_PlayNormal, s_PlaySelect, CALLBACK_1(MenuLayer2::menuCallback, this));
|
||||
CCMenuItemImage* item2 = CCMenuItemImage::create(s_HighNormal, s_HighSelect, CALLBACK_1(MenuLayer2::menuCallbackOpacity, this));
|
||||
CCMenuItemImage* item3 = CCMenuItemImage::create(s_AboutNormal, s_AboutSelect, CALLBACK_1(MenuLayer2::menuCallbackAlign, this));
|
||||
|
||||
item1->setScaleX( 1.5f );
|
||||
item2->setScaleX( 0.5f );
|
||||
|
@ -372,7 +372,7 @@ MenuLayer4::MenuLayer4()
|
|||
title1->setEnabled(false);
|
||||
CCMenuItemFont::setFontName( "Marker Felt" );
|
||||
CCMenuItemFont::setFontSize(34);
|
||||
CCMenuItemToggle* item1 = CCMenuItemToggle::createWithCallback( std::bind( &MenuLayer4::menuCallback, this, std::placeholders::_1),
|
||||
CCMenuItemToggle* item1 = CCMenuItemToggle::createWithCallback( CALLBACK_1(MenuLayer4::menuCallback, this),
|
||||
CCMenuItemFont::create( "On" ),
|
||||
CCMenuItemFont::create( "Off"),
|
||||
NULL );
|
||||
|
@ -383,7 +383,7 @@ MenuLayer4::MenuLayer4()
|
|||
title2->setEnabled(false);
|
||||
CCMenuItemFont::setFontName( "Marker Felt" );
|
||||
CCMenuItemFont::setFontSize(34);
|
||||
CCMenuItemToggle *item2 = CCMenuItemToggle::createWithCallback(std::bind( &MenuLayer4::menuCallback, this, std::placeholders::_1),
|
||||
CCMenuItemToggle *item2 = CCMenuItemToggle::createWithCallback(CALLBACK_1(MenuLayer4::menuCallback, this),
|
||||
CCMenuItemFont::create( "On" ),
|
||||
CCMenuItemFont::create( "Off"),
|
||||
NULL );
|
||||
|
@ -394,7 +394,7 @@ MenuLayer4::MenuLayer4()
|
|||
title3->setEnabled( false );
|
||||
CCMenuItemFont::setFontName( "Marker Felt" );
|
||||
CCMenuItemFont::setFontSize(34);
|
||||
CCMenuItemToggle *item3 = CCMenuItemToggle::createWithCallback(std::bind( &MenuLayer4::menuCallback, this, std::placeholders::_1),
|
||||
CCMenuItemToggle *item3 = CCMenuItemToggle::createWithCallback(CALLBACK_1(MenuLayer4::menuCallback, this),
|
||||
CCMenuItemFont::create( "High" ),
|
||||
CCMenuItemFont::create( "Low" ),
|
||||
NULL );
|
||||
|
@ -405,7 +405,7 @@ MenuLayer4::MenuLayer4()
|
|||
title4->setEnabled(false);
|
||||
CCMenuItemFont::setFontName( "Marker Felt" );
|
||||
CCMenuItemFont::setFontSize(34);
|
||||
CCMenuItemToggle *item4 = CCMenuItemToggle::createWithCallback(std::bind( &MenuLayer4::menuCallback, this, std::placeholders::_1),
|
||||
CCMenuItemToggle *item4 = CCMenuItemToggle::createWithCallback(CALLBACK_1(MenuLayer4::menuCallback, this),
|
||||
CCMenuItemFont::create( "Off" ),
|
||||
NULL );
|
||||
|
||||
|
@ -426,7 +426,7 @@ MenuLayer4::MenuLayer4()
|
|||
CCMenuItemFont::setFontSize( 34 );
|
||||
|
||||
CCLabelBMFont *label = CCLabelBMFont::create( "go back", "fonts/bitmapFontTest3.fnt" );
|
||||
CCMenuItemLabel* back = CCMenuItemLabel::create(label, std::bind( &MenuLayer4::backCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemLabel* back = CCMenuItemLabel::create(label, CALLBACK_1(MenuLayer4::backCallback, this) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(
|
||||
title1, title2,
|
||||
|
@ -467,7 +467,7 @@ MenuLayerPriorityTest::MenuLayerPriorityTest()
|
|||
// Menu 1
|
||||
CCMenuItemFont::setFontName("Marker Felt");
|
||||
CCMenuItemFont::setFontSize(18);
|
||||
CCMenuItemFont *item1 = CCMenuItemFont::create("Return to Main Menu", std::bind( &MenuLayerPriorityTest::menuCallback, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item1 = CCMenuItemFont::create("Return to Main Menu", CALLBACK_1(MenuLayerPriorityTest::menuCallback, this));
|
||||
CCMenuItemFont *item2 = CCMenuItemFont::create("Disable menu for 5 seconds", [&](CCObject *sender) {
|
||||
m_pMenu1->setEnabled(false);
|
||||
CCDelayTime *wait = CCDelayTime::create(5);
|
||||
|
@ -518,9 +518,9 @@ void MenuLayerPriorityTest::menuCallback(CCObject* pSender)
|
|||
// BugsTest
|
||||
BugsTest::BugsTest()
|
||||
{
|
||||
CCMenuItemFont *issue1410 = CCMenuItemFont::create("Issue 1410", std::bind( &BugsTest::issue1410MenuCallback, this, std::placeholders::_1));
|
||||
CCMenuItemFont *issue1410_2 = CCMenuItemFont::create("Issue 1410 #2", std::bind( &BugsTest::issue1410v2MenuCallback, this, std::placeholders::_1));
|
||||
CCMenuItemFont *back = CCMenuItemFont::create("Back", std::bind( &BugsTest::backMenuCallback, this, std::placeholders::_1));
|
||||
CCMenuItemFont *issue1410 = CCMenuItemFont::create("Issue 1410", CALLBACK_1(BugsTest::issue1410MenuCallback, this));
|
||||
CCMenuItemFont *issue1410_2 = CCMenuItemFont::create("Issue 1410 #2", CALLBACK_1(BugsTest::issue1410v2MenuCallback, this));
|
||||
CCMenuItemFont *back = CCMenuItemFont::create("Back", CALLBACK_1(BugsTest::backMenuCallback, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(issue1410, issue1410_2, back, NULL);
|
||||
addChild(menu);
|
||||
|
@ -564,7 +564,7 @@ RemoveMenuItemWhenMove::RemoveMenuItemWhenMove()
|
|||
item = CCMenuItemFont::create("item 1");
|
||||
item->retain();
|
||||
|
||||
CCMenuItemFont *back = CCMenuItemFont::create("go back", std::bind( &RemoveMenuItemWhenMove::goBack, this, std::placeholders::_1));
|
||||
CCMenuItemFont *back = CCMenuItemFont::create("go back", CALLBACK_1(RemoveMenuItemWhenMove::goBack, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item, back, NULL);
|
||||
addChild(menu);
|
||||
|
|
|
@ -232,7 +232,7 @@ void MotionStreakTest::onEnter()
|
|||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCMenuItemToggle *itemMode = CCMenuItemToggle::createWithCallback( std::bind(&MotionStreakTest::modeCallback, this, std::placeholders::_1),
|
||||
CCMenuItemToggle *itemMode = CCMenuItemToggle::createWithCallback( CALLBACK_1(MotionStreakTest::modeCallback, this),
|
||||
CCMenuItemFont::create("Use High Quality Mode"),
|
||||
CCMenuItemFont::create("Use Fast Mode"),
|
||||
NULL);
|
||||
|
|
|
@ -1078,7 +1078,7 @@ void ParticleDemo::onEnter(void)
|
|||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCMenuItemToggle* item4 = CCMenuItemToggle::createWithCallback( std::bind( &ParticleDemo::toggleCallback, this, std::placeholders::_1),
|
||||
CCMenuItemToggle* item4 = CCMenuItemToggle::createWithCallback( CALLBACK_1(ParticleDemo::toggleCallback, this),
|
||||
CCMenuItemFont::create( "Free Movement" ),
|
||||
CCMenuItemFont::create( "Relative Movement" ),
|
||||
CCMenuItemFont::create( "Grouped Movement" ),
|
||||
|
|
|
@ -125,7 +125,7 @@ void ParticleMainScene::initWithSubTest(int asubtest, int particles)
|
|||
{
|
||||
char str[10] = {0};
|
||||
sprintf(str, "%d ", i);
|
||||
CCMenuItemFont* itemFont = CCMenuItemFont::create(str, std::bind( &ParticleMainScene::testNCallback, this, std::placeholders::_1));
|
||||
CCMenuItemFont* itemFont = CCMenuItemFont::create(str, CALLBACK_1(ParticleMainScene::testNCallback, this));
|
||||
itemFont->setTag(i);
|
||||
pSubMenu->addChild(itemFont, 10);
|
||||
|
||||
|
|
|
@ -287,9 +287,9 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
|
|||
quantityNodes = 0;
|
||||
|
||||
CCMenuItemFont::setFontSize(65);
|
||||
CCMenuItemFont *decrease = CCMenuItemFont::create(" - ", std::bind( &SpriteMainScene::onDecrease, this, std::placeholders::_1));
|
||||
CCMenuItemFont *decrease = CCMenuItemFont::create(" - ", CALLBACK_1(SpriteMainScene::onDecrease, this));
|
||||
decrease->setColor(ccc3(0,200,20));
|
||||
CCMenuItemFont *increase = CCMenuItemFont::create(" + ", std::bind( &SpriteMainScene::onIncrease, this, std::placeholders::_1));
|
||||
CCMenuItemFont *increase = CCMenuItemFont::create(" + ", CALLBACK_1(SpriteMainScene::onIncrease, this));
|
||||
increase->setColor(ccc3(0,200,20));
|
||||
|
||||
CCMenu *menu = CCMenu::create(decrease, increase, NULL);
|
||||
|
@ -314,7 +314,7 @@ void SpriteMainScene::initWithSubTest(int asubtest, int nNodes)
|
|||
{
|
||||
char str[10] = {0};
|
||||
sprintf(str, "%d ", i);
|
||||
CCMenuItemFont* itemFont = CCMenuItemFont::create(str, std::bind( &SpriteMainScene::testNCallback, this, std::placeholders::_1));
|
||||
CCMenuItemFont* itemFont = CCMenuItemFont::create(str, CALLBACK_1(SpriteMainScene::testNCallback, this));
|
||||
itemFont->setTag(i);
|
||||
pSubMenu->addChild(itemFont, 10);
|
||||
|
||||
|
|
|
@ -70,16 +70,16 @@ void PerformBasicLayer::onEnter()
|
|||
|
||||
CCMenuItemFont::setFontName("Arial");
|
||||
CCMenuItemFont::setFontSize(24);
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", std::bind( &PerformBasicLayer::toMainLayer, this, std::placeholders::_1));
|
||||
CCMenuItemFont* pMainItem = CCMenuItemFont::create("Back", CALLBACK_1(PerformBasicLayer::toMainLayer, this));
|
||||
pMainItem->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
|
||||
CCMenu* pMenu = CCMenu::create(pMainItem, NULL);
|
||||
pMenu->setPosition( CCPointZero );
|
||||
|
||||
if (m_bControlMenuVisible)
|
||||
{
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, std::bind( &PerformBasicLayer::backCallback, this, std::placeholders::_1));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, std::bind( &PerformBasicLayer::restartCallback, this, std::placeholders::_1));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, std::bind( &PerformBasicLayer::nextCallback, this, std::placeholders::_1));
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, CALLBACK_1(PerformBasicLayer::backCallback, this));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, CALLBACK_1(PerformBasicLayer::restartCallback, this));
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, CALLBACK_1(PerformBasicLayer::nextCallback, this));
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
|
|
@ -115,8 +115,8 @@ RenderTextureSave::RenderTextureSave()
|
|||
|
||||
// Save Image menu
|
||||
CCMenuItemFont::setFontSize(16);
|
||||
CCMenuItem *item1 = CCMenuItemFont::create("Save Image", std::bind( &RenderTextureSave::saveImage, this, std::placeholders::_1));
|
||||
CCMenuItem *item2 = CCMenuItemFont::create("Clear", std::bind( &RenderTextureSave::clearImage, this, std::placeholders::_1));
|
||||
CCMenuItem *item1 = CCMenuItemFont::create("Save Image", CALLBACK_1(RenderTextureSave::saveImage, this));
|
||||
CCMenuItem *item2 = CCMenuItemFont::create("Clear", CALLBACK_1(RenderTextureSave::clearImage, this));
|
||||
CCMenu *menu = CCMenu::create(item1, item2, NULL);
|
||||
this->addChild(menu);
|
||||
menu->alignItemsVertically();
|
||||
|
@ -529,7 +529,7 @@ RenderTextureTargetNode::RenderTextureTargetNode()
|
|||
scheduleUpdate();
|
||||
|
||||
// Toggle clear on / off
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Clear On/Off", std::bind( &RenderTextureTargetNode::touched, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Clear On/Off", CALLBACK_1(RenderTextureTargetNode::touched, this));
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
addChild(menu);
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ enum
|
|||
|
||||
SceneTestLayer1::SceneTestLayer1()
|
||||
{
|
||||
CCMenuItemFont* item1 = CCMenuItemFont::create( "Test pushScene", std::bind(&SceneTestLayer1::onPushScene, this, std::placeholders::_1));
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::create( "Test pushScene w/transition", std::bind(&SceneTestLayer1::onPushSceneTran, this, std::placeholders::_1));
|
||||
CCMenuItemFont* item3 = CCMenuItemFont::create( "Quit", std::bind(&SceneTestLayer1::onQuit, this, std::placeholders::_1));
|
||||
CCMenuItemFont* item1 = CCMenuItemFont::create( "Test pushScene", CALLBACK_1(SceneTestLayer1::onPushScene, this));
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::create( "Test pushScene w/transition", CALLBACK_1(SceneTestLayer1::onPushSceneTran, this));
|
||||
CCMenuItemFont* item3 = CCMenuItemFont::create( "Quit", CALLBACK_1(SceneTestLayer1::onQuit, this));
|
||||
|
||||
CCMenu* menu = CCMenu::create( item1, item2, item3, NULL );
|
||||
menu->alignItemsVertically();
|
||||
|
@ -103,9 +103,9 @@ SceneTestLayer2::SceneTestLayer2()
|
|||
{
|
||||
m_timeCounter = 0;
|
||||
|
||||
CCMenuItemFont* item1 = CCMenuItemFont::create( "replaceScene", std::bind(&SceneTestLayer2::onReplaceScene, this, std::placeholders::_1));
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::create( "replaceScene w/transition", std::bind(&SceneTestLayer2::onReplaceSceneTran, this, std::placeholders::_1));
|
||||
CCMenuItemFont* item3 = CCMenuItemFont::create( "Go Back", std::bind(&SceneTestLayer2::onGoBack, this, std::placeholders::_1));
|
||||
CCMenuItemFont* item1 = CCMenuItemFont::create( "replaceScene", CALLBACK_1(SceneTestLayer2::onReplaceScene, this));
|
||||
CCMenuItemFont* item2 = CCMenuItemFont::create( "replaceScene w/transition", CALLBACK_1(SceneTestLayer2::onReplaceSceneTran, this));
|
||||
CCMenuItemFont* item3 = CCMenuItemFont::create( "Go Back", CALLBACK_1(SceneTestLayer2::onGoBack, this));
|
||||
|
||||
CCMenu* menu = CCMenu::create( item1, item2, item3, NULL );
|
||||
menu->alignItemsVertically();
|
||||
|
@ -171,10 +171,10 @@ bool SceneTestLayer3::init()
|
|||
{
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCMenuItemFont *item0 = CCMenuItemFont::create("Touch to pushScene (self)", std::bind(&SceneTestLayer3::item0Clicked, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item1 = CCMenuItemFont::create("Touch to popScene", std::bind(&SceneTestLayer3::item1Clicked, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item2 = CCMenuItemFont::create("Touch to popToRootScene", std::bind(&SceneTestLayer3::item2Clicked, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item3 = CCMenuItemFont::create("Touch to popToSceneStackLevel(2)", std::bind(&SceneTestLayer3::item3Clicked, this, std::placeholders::_1));
|
||||
CCMenuItemFont *item0 = CCMenuItemFont::create("Touch to pushScene (self)", CALLBACK_1(SceneTestLayer3::item0Clicked, this));
|
||||
CCMenuItemFont *item1 = CCMenuItemFont::create("Touch to popScene", CALLBACK_1(SceneTestLayer3::item1Clicked, this));
|
||||
CCMenuItemFont *item2 = CCMenuItemFont::create("Touch to popToRootScene", CALLBACK_1(SceneTestLayer3::item2Clicked, this));
|
||||
CCMenuItemFont *item3 = CCMenuItemFont::create("Touch to popToSceneStackLevel(2)", CALLBACK_1(SceneTestLayer3::item3Clicked, this));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item0, item1, item2, item3, NULL);
|
||||
this->addChild(menu);
|
||||
|
|
|
@ -91,31 +91,7 @@ CCLayer* restartSchedulerTest()
|
|||
//------------------------------------------------------------------
|
||||
void SchedulerTestLayer::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 32);
|
||||
addChild(label);
|
||||
label->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-50));
|
||||
|
||||
std::string subTitle = subtitle();
|
||||
if(! subTitle.empty())
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(subTitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(ccp(VisibleRect::center().x, VisibleRect::top().y-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(SchedulerTestLayer::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png","Images/r2.png", this, menu_selector(SchedulerTestLayer::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", this, menu_selector(SchedulerTestLayer::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void SchedulerTestLayer::backCallback(CCObject* pSender)
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
#include "cocos2d.h"
|
||||
#include "cocos-ext.h"
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
USING_NS_CC_EXT;
|
||||
|
||||
class SchedulerTestLayer : public CCLayer
|
||||
class SchedulerTestLayer : public BaseTest
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
|
|
|
@ -116,33 +116,7 @@ std::string TextInputTest::title()
|
|||
|
||||
void TextInputTest::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF* label = CCLabelTTF::create(title().c_str(), "Arial", 24);
|
||||
addChild(label);
|
||||
label->setPosition(ccp(s.width/2, s.height-50));
|
||||
|
||||
std::string subTitle = m_pNotificationLayer->subtitle();
|
||||
if(! subTitle.empty())
|
||||
{
|
||||
CCLabelTTF* l = CCLabelTTF::create(subTitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create("Images/b1.png", "Images/b2.png", this, menu_selector(TextInputTest::backCallback));
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create("Images/r1.png","Images/r2.png", this, menu_selector(TextInputTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create("Images/f1.png", "Images/f2.png", this, menu_selector(TextInputTest::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
|
||||
addChild(menu, 1);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
#define __TEXT_INPUT_TEST_H__
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class KeyboardNotificationLayer;
|
||||
|
||||
/**
|
||||
@brief TextInputTest for retain prev, reset, next, main menu buttons.
|
||||
*/
|
||||
class TextInputTest : public CCLayer
|
||||
class TextInputTest : public BaseTest
|
||||
{
|
||||
KeyboardNotificationLayer * m_pNotificationLayer;
|
||||
public:
|
||||
|
|
|
@ -1814,19 +1814,19 @@ void TextureMemoryAlloc::onEnter()
|
|||
|
||||
CCMenuItemFont::setFontSize(24);
|
||||
|
||||
CCMenuItem *item1 = CCMenuItemFont::create("PNG", std::bind(&TextureMemoryAlloc::updateImage, this, std::placeholders::_1));
|
||||
CCMenuItem *item1 = CCMenuItemFont::create("PNG", CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
||||
item1->setTag(0);
|
||||
|
||||
CCMenuItem *item2 = CCMenuItemFont::create("RGBA8", std::bind(&TextureMemoryAlloc::updateImage, this, std::placeholders::_1));
|
||||
CCMenuItem *item2 = CCMenuItemFont::create("RGBA8", CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
||||
item2->setTag(1);
|
||||
|
||||
CCMenuItem *item3 = CCMenuItemFont::create("RGB8", std::bind(&TextureMemoryAlloc::updateImage, this, std::placeholders::_1));
|
||||
CCMenuItem *item3 = CCMenuItemFont::create("RGB8", CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
||||
item3->setTag(2);
|
||||
|
||||
CCMenuItem *item4 = CCMenuItemFont::create("RGBA4", std::bind(&TextureMemoryAlloc::updateImage, this, std::placeholders::_1));
|
||||
CCMenuItem *item4 = CCMenuItemFont::create("RGBA4", CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
||||
item4->setTag(3);
|
||||
|
||||
CCMenuItem *item5 = CCMenuItemFont::create("A8", std::bind(&TextureMemoryAlloc::updateImage, this, std::placeholders::_1));
|
||||
CCMenuItem *item5 = CCMenuItemFont::create("A8", CALLBACK_1(TextureMemoryAlloc::updateImage, this));
|
||||
item5->setTag(4);
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, item4, item5, NULL);
|
||||
|
@ -1834,7 +1834,7 @@ void TextureMemoryAlloc::onEnter()
|
|||
|
||||
addChild(menu);
|
||||
|
||||
CCMenuItemFont *warmup = CCMenuItemFont::create("warm up texture", std::bind(&TextureMemoryAlloc::changeBackgroundVisible, this, std::placeholders::_1));
|
||||
CCMenuItemFont *warmup = CCMenuItemFont::create("warm up texture", CALLBACK_1(TextureMemoryAlloc::changeBackgroundVisible, this));
|
||||
|
||||
CCMenu *menu2 = CCMenu::create(warmup, NULL);
|
||||
|
||||
|
|
|
@ -297,9 +297,9 @@ TestLayer1::TestLayer1(void)
|
|||
addChild( label);
|
||||
|
||||
// menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer1::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer1::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(TestLayer1::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, CALLBACK_1(TestLayer1::backCallback, this) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, CALLBACK_1(TestLayer1::restartCallback, this) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, CALLBACK_1(TestLayer1::nextCallback, this) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
|
@ -426,9 +426,9 @@ TestLayer2::TestLayer2()
|
|||
addChild( label);
|
||||
|
||||
// menu
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(TestLayer2::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(TestLayer2::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(TestLayer2::nextCallback) );
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, CALLBACK_1(TestLayer2::backCallback, this) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, CALLBACK_1(TestLayer2::restartCallback, this) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, CALLBACK_1(TestLayer2::nextCallback, this) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
|
|
|
@ -58,33 +58,7 @@ CCLayer* restartZwoptexTest()
|
|||
//------------------------------------------------------------------
|
||||
void ZwoptexTest::onEnter()
|
||||
{
|
||||
CCLayer::onEnter();
|
||||
|
||||
CCSize s = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
CCLabelTTF *label = CCLabelTTF::create(title().c_str(), "Arial", 26);
|
||||
addChild(label, 1);
|
||||
label->setPosition(ccp(s.width/2, s.height-50));
|
||||
|
||||
std::string strSubTitle = subtitle();
|
||||
if (strSubTitle.length() > 0)
|
||||
{
|
||||
CCLabelTTF *l = CCLabelTTF::create(strSubTitle.c_str(), "Thonburi", 16);
|
||||
addChild(l, 1);
|
||||
l->setPosition(ccp(s.width/2, s.height-80));
|
||||
}
|
||||
|
||||
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ZwoptexTest::backCallback) );
|
||||
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ZwoptexTest::restartCallback) );
|
||||
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(ZwoptexTest::nextCallback) );
|
||||
|
||||
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
|
||||
|
||||
menu->setPosition(CCPointZero);
|
||||
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
|
||||
addChild(menu, 1);
|
||||
BaseTest::onEnter();
|
||||
}
|
||||
|
||||
void ZwoptexTest::restartCallback(CCObject* pSender)
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#define __ZWOPTEX_TEST_H__
|
||||
|
||||
#include "../testBasic.h"
|
||||
#include "../BaseTest.h"
|
||||
|
||||
class ZwoptexTest : public CCLayer
|
||||
class ZwoptexTest : public BaseTest
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
|
|
|
@ -92,7 +92,7 @@ TestController::TestController()
|
|||
: m_tBeginPos(CCPointZero)
|
||||
{
|
||||
// add close menu
|
||||
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(s_pPathClose, s_pPathClose, std::bind( &TestController::closeCallback, this, std::placeholders::_1) );
|
||||
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(s_pPathClose, s_pPathClose, CALLBACK_1(TestController::closeCallback, this) );
|
||||
CCMenu* pMenu =CCMenu::create(pCloseItem, NULL);
|
||||
|
||||
pMenu->setPosition( CCPointZero );
|
||||
|
@ -107,7 +107,7 @@ TestController::TestController()
|
|||
// #else
|
||||
CCLabelTTF* label = CCLabelTTF::create( g_aTestNames[i].test_name, "Arial", 24);
|
||||
// #endif
|
||||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, std::bind(&TestController::menuCallback, this, std::placeholders::_1));
|
||||
CCMenuItemLabel* pMenuItem = CCMenuItemLabel::create(label, CALLBACK_1(TestController::menuCallback, this));
|
||||
|
||||
m_pItemMenu->addChild(pMenuItem, i + 10000);
|
||||
pMenuItem->setPosition( ccp( VisibleRect::center().x, (VisibleRect::top().y - (i + 1) * LINE_SPACE) ));
|
||||
|
|
Loading…
Reference in New Issue