axmol/tests/test-cpp/Classes/ExtensionsTest/CocosBuilderTest/TimelineCallbackTest/TimelineCallbackTestLayer.cpp

52 lines
1.6 KiB
C++
Raw Normal View History

#include "TimelineCallbackTestLayer.h"
2013-03-21 09:00:55 +08:00
#include "SimpleAudioEngine.h"
USING_NS_CC;
USING_NS_CC_EXT;
using namespace cocosbuilder;
TimelineCallbackTestLayer::TimelineCallbackTestLayer()
: _helloLabel(NULL)
{}
TimelineCallbackTestLayer::~TimelineCallbackTestLayer()
{
CC_SAFE_RELEASE(_helloLabel);
2013-03-21 09:00:55 +08:00
CocosDenshion::SimpleAudioEngine::end();
}
SEL_MenuHandler TimelineCallbackTestLayer::onResolveCCBCCMenuItemSelector(Object * pTarget, const char * pSelectorName) {
return NULL;
}
2013-07-26 15:22:45 +08:00
Control::Handler TimelineCallbackTestLayer::onResolveCCBCCControlSelector(Object * pTarget, const char * pSelectorName) {
return NULL;
}
SEL_CallFuncN TimelineCallbackTestLayer::onResolveCCBCCCallFuncSelector(Object * pTarget, const char* pSelectorName)
{
CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback1", TimelineCallbackTestLayer::onCallback1);
CCB_SELECTORRESOLVER_CALLFUNC_GLUE(this, "onCallback2", TimelineCallbackTestLayer::onCallback2);
return NULL;
}
bool TimelineCallbackTestLayer::onAssignCCBMemberVariable(Object * pTarget, const char * pMemberVariableName, Node * pNode) {
CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "helloLabel", LabelTTF *, this->_helloLabel);
return false;
}
void TimelineCallbackTestLayer::onCallback1(Node* sender)
{
// Rotate the label when the button is pressed
this->_helloLabel->runAction(RotateBy::create(1,360));
this->_helloLabel->setString("Callback 1");
}
void TimelineCallbackTestLayer::onCallback2(Node* sender)
{
// Rotate the label when the button is pressed
this->_helloLabel->runAction(RotateBy::create(1,-360));
this->_helloLabel->setString("Callback 2");
}