2012-06-14 05:19:13 +08:00
|
|
|
#ifndef _HELLOCOCOSBUILDERLAYER_H_
|
|
|
|
#define _HELLOCOCOSBUILDERLAYER_H_
|
|
|
|
|
|
|
|
#include "cocos2d.h"
|
2013-10-16 16:48:39 +08:00
|
|
|
#include "extensions/cocos-ext.h"
|
2013-10-16 11:19:01 +08:00
|
|
|
#include "cocosbuilder/CocosBuilder.h"
|
2012-06-14 05:19:13 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Note: for some pretty hard fucked up reason, the order of inheritance is important!
|
2013-06-20 14:17:10 +08:00
|
|
|
* When Layer is the 'first' inherited object:
|
2012-06-14 05:19:13 +08:00
|
|
|
* During runtime the method call to the (pure virtual) 'interfaces' fails jumping into a bogus method or just doing nothing:
|
|
|
|
* #0 0x000cf840 in non-virtual thunk to HelloCocos....
|
|
|
|
* #1 ....
|
|
|
|
*
|
|
|
|
* This thread describes the problem:
|
|
|
|
* http://www.cocoabuilder.com/archive/xcode/265549-crash-in-virtual-method-call.html
|
|
|
|
*/
|
2012-06-16 12:48:20 +08:00
|
|
|
class HelloCocosBuilderLayer
|
2013-06-20 14:17:10 +08:00
|
|
|
: public cocos2d::Layer
|
2013-10-15 18:00:03 +08:00
|
|
|
, public cocosbuilder::CCBSelectorResolver
|
|
|
|
, public cocosbuilder::CCBMemberVariableAssigner
|
|
|
|
, public cocosbuilder::NodeLoaderListener
|
2012-06-16 12:48:20 +08:00
|
|
|
{
|
2012-06-14 05:19:13 +08:00
|
|
|
public:
|
2012-06-20 11:48:31 +08:00
|
|
|
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(HelloCocosBuilderLayer, create);
|
2012-06-14 05:19:13 +08:00
|
|
|
|
2012-06-19 16:31:26 +08:00
|
|
|
HelloCocosBuilderLayer();
|
|
|
|
virtual ~HelloCocosBuilderLayer();
|
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
void openTest(const char * pCCBFileName, const char * nodeName = NULL, cocosbuilder::NodeLoader * nodeLoader = NULL);
|
2012-06-14 05:19:13 +08:00
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::Ref * pTarget, const char * pSelectorName);
|
|
|
|
virtual cocos2d::extension::Control::Handler onResolveCCBCCControlSelector(cocos2d::Ref * pTarget, const char * pSelectorName);
|
|
|
|
virtual bool onAssignCCBMemberVariable(cocos2d::Ref * pTarget, const char * pMemberVariableName, cocos2d::Node * node);
|
|
|
|
virtual bool onAssignCCBCustomProperty(Ref* pTarget, const char* pMemberVariableName, const cocos2d::Value& pCCBValue);
|
2013-10-15 18:00:03 +08:00
|
|
|
virtual void onNodeLoaded(cocos2d::Node * node, cocosbuilder::NodeLoader * nodeLoader);
|
2012-06-14 05:19:13 +08:00
|
|
|
|
2014-02-20 10:53:49 +08:00
|
|
|
void onMenuTestClicked(cocos2d::Ref * sender, cocos2d::extension::Control::EventType pControlEvent);
|
|
|
|
void onSpriteTestClicked(cocos2d::Ref * sender, cocos2d::extension::Control::EventType pControlEvent);
|
|
|
|
void onButtonTestClicked(cocos2d::Ref * sender, cocos2d::extension::Control::EventType pControlEvent);
|
|
|
|
void onAnimationsTestClicked(cocos2d::Ref * sender, cocos2d::extension::Control::EventType pControlEvent);
|
|
|
|
void onParticleSystemTestClicked(cocos2d::Ref * sender, cocos2d::extension::Control::EventType pControlEvent);
|
|
|
|
void onScrollViewTestClicked(cocos2d::Ref * sender, cocos2d::extension::Control::EventType pControlEvent);
|
|
|
|
void onTimelineCallbackSoundClicked(cocos2d::Ref * sender, cocos2d::extension::Control::EventType pControlEvent);
|
2012-06-14 05:19:13 +08:00
|
|
|
|
|
|
|
private:
|
2013-06-20 14:17:10 +08:00
|
|
|
cocos2d::Sprite * mBurstSprite;
|
|
|
|
cocos2d::LabelTTF * mTestTitleLabelTTF;
|
2013-01-21 18:37:17 +08:00
|
|
|
|
|
|
|
int mCustomPropertyInt;
|
|
|
|
float mCustomPropertyFloat;
|
|
|
|
bool mCustomPropertyBoolean;
|
|
|
|
std::string mCustomPropertyString;
|
2012-06-14 05:19:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|