2013-03-19 16:33:23 +08:00
|
|
|
#include "TimelineCallbackTestLayer.h"
|
|
|
|
|
|
|
|
USING_NS_CC;
|
|
|
|
USING_NS_CC_EXT;
|
2013-10-15 18:00:03 +08:00
|
|
|
using namespace cocosbuilder;
|
2013-03-19 16:33:23 +08:00
|
|
|
|
|
|
|
TimelineCallbackTestLayer::TimelineCallbackTestLayer()
|
2014-04-09 22:53:59 +08:00
|
|
|
: _helloLabel(nullptr)
|
2013-03-19 16:33:23 +08:00
|
|
|
{}
|
|
|
|
|
|
|
|
TimelineCallbackTestLayer::~TimelineCallbackTestLayer()
|
|
|
|
{
|
|
|
|
CC_SAFE_RELEASE(_helloLabel);
|
2013-03-21 09:00:55 +08:00
|
|
|
CocosDenshion::SimpleAudioEngine::end();
|
2013-03-19 16:33:23 +08:00
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
SEL_MenuHandler TimelineCallbackTestLayer::onResolveCCBCCMenuItemSelector(Ref * pTarget, const char * pSelectorName) {
|
2013-03-19 16:33:23 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
Control::Handler TimelineCallbackTestLayer::onResolveCCBCCControlSelector(Ref * pTarget, const char * pSelectorName) {
|
2013-03-19 16:33:23 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
SEL_CallFuncN TimelineCallbackTestLayer::onResolveCCBCCCallFuncSelector(Ref * pTarget, const char* pSelectorName)
|
2013-03-19 16:33:23 +08:00
|
|
|
{
|
|
|
|
CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback1", TimelineCallbackTestLayer::onCallback1);
|
|
|
|
CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback2", TimelineCallbackTestLayer::onCallback2);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
bool TimelineCallbackTestLayer::onAssignCCBMemberVariable(Ref * pTarget, const char * pMemberVariableName, Node * pNode) {
|
2014-03-14 21:06:40 +08:00
|
|
|
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "helloLabel", Label *, this->_helloLabel);
|
2013-03-19 16:33:23 +08:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
void TimelineCallbackTestLayer::onCallback1(Node* sender)
|
2013-03-19 16:33:23 +08:00
|
|
|
{
|
|
|
|
// Rotate the label when the button is pressed
|
2013-06-20 14:17:10 +08:00
|
|
|
this->_helloLabel->runAction(RotateBy::create(1,360));
|
2013-03-19 16:33:23 +08:00
|
|
|
this->_helloLabel->setString("Callback 1");
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
void TimelineCallbackTestLayer::onCallback2(Node* sender)
|
2013-03-19 16:33:23 +08:00
|
|
|
{
|
|
|
|
// Rotate the label when the button is pressed
|
2013-06-20 14:17:10 +08:00
|
|
|
this->_helloLabel->runAction(RotateBy::create(1,-360));
|
2013-03-19 16:33:23 +08:00
|
|
|
this->_helloLabel->setString("Callback 2");
|
|
|
|
}
|