Adding changes to CCBreader

This commit is contained in:
Rohan Kuruvilla 2012-11-22 01:15:30 -06:00 committed by James Chen
parent 3980a710a3
commit 36bbd80b68
7 changed files with 56 additions and 8 deletions

View File

@ -71,6 +71,11 @@ CCArray* CCBAnimationManager::getSequences()
return mSequences;
}
void CCBAnimationManager::setSequences(CCArray* seq)
{
mSequences = seq;
}
int CCBAnimationManager::getAutoPlaySequenceId()
{
return mAutoPlaySequenceId;

View File

@ -39,6 +39,7 @@ private:
SEL_CallFunc mAnimationCompleteCallbackFunc;
CCObject *mTarget;
public:
CCBAnimationManager();
~CCBAnimationManager();
@ -46,6 +47,8 @@ public:
virtual bool init();
CCArray* getSequences();
void setSequences(CCArray* seq);
int getAutoPlaySequenceId();
void setAutoPlaySequenceId(int autoPlaySequenceId);

View File

@ -252,6 +252,7 @@ CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const
}
for(int i = 0; i < mAnimationManagers.size(); ++i) {
mAnimationManagers[i].first->setUserObject(mAnimationManagers[i].second);
if(jsControlled) {
mNodesWithAnimationManagers->addObject(mAnimationManagers[i].first);
mAnimationManagerForNodes->addObject(mAnimationManagers[i].second);

View File

@ -35,12 +35,12 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
{
setProp = true;
}
#ifdef __CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
if(platform == kCCBPlatformIOS)
{
setProp = true;
}
#elif defined(__CC_PLATFORM_MAC)
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
if(platform == kCCBPlatformMac)
{
setProp = true;

View File

@ -15,6 +15,7 @@ LOCAL_SRC_FILES := ScriptingCore.cpp \
js_bindings_chipmunk_functions.cpp \
js_bindings_chipmunk_auto_classes.cpp \
js_bindings_chipmunk_registration.cpp \
js_bindings_ccbreader.cpp \
js_bindings_core.cpp \
generated/cocos2dx.cpp

View File

@ -1158,6 +1158,45 @@ JSBool js_cocos2dx_release(JSContext *cx, uint32_t argc, jsval *vp)
return JS_FALSE;
}
JSBool js_cocos2dx_CCNode_removeChild(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cocos2d::CCNode* cobj = (cocos2d::CCNode *)(proxy ? proxy->ptr : NULL);
TEST_NATIVE_OBJECT(cx, cobj)
if (argc == 2) {
cocos2d::CCNode* arg0;
JSBool arg1;
do {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
JS_GET_NATIVE_PROXY(proxy, tmpObj);
arg0 = (cocos2d::CCNode*)(proxy ? proxy->ptr : NULL);
TEST_NATIVE_OBJECT(cx, arg0)
} while (0);
JS_ValueToBoolean(cx, argv[1], &arg1);
cobj->removeChild(arg0, arg1);
return JS_TRUE;
} else if(argc == 1) {
cocos2d::CCNode* arg0;
do {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[0]);
JS_GET_NATIVE_PROXY(proxy, tmpObj);
arg0 = (cocos2d::CCNode*)(proxy ? proxy->ptr : NULL);
TEST_NATIVE_OBJECT(cx, arg0)
} while (0);
cobj->removeChild(arg0, true);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_cocos2dx_CCSet_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj;
@ -2032,6 +2071,7 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global)
JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "retain", js_cocos2dx_retain, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "release", js_cocos2dx_release, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "removeChild", js_cocos2dx_CCNode_removeChild, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCSprite_prototype, "setBlendFunc", js_cocos2dx_CCSprite_setBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCSpriteBatchNode_prototype, "setBlendFunc", js_cocos2dx_CCSpriteBatchNode_setBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT);

View File

@ -35,7 +35,7 @@ classes = CCSprite.* CCScene CCNode CCDirector CCLayer.* CCMenu.* CCTouch CC.*Ac
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = CCNode::[.*Transform convertToWindowSpace getChildren setPosition getGrid setGLServerState description getShaderProgram getUserObject .*UserData getGLServerState unscheduleAllSelectors],
skip = CCNode::[.*Transform convertToWindowSpace getChildren setPosition getGrid setGLServerState description getShaderProgram getUserObject .*UserData getGLServerState removeChild$ unscheduleAllSelectors],
CCSprite::[getQuad displayFrame getBlendFunc setPosition setBlendFunc setSpriteBatchNode getSpriteBatchNode],
CCSpriteBatchNode::[getBlendFunc setBlendFunc],
CCMotionStreak::[getBlendFunc setBlendFunc],
@ -124,8 +124,6 @@ rename_functions = CCDirector::[sharedDirector=getInstance],
CCTMXTiledMap::[layerNamed=getLayer objectGroupNamed=getObjectGroup propertyNamed=getProperty],
CCUserDefault::[sharedUserDefault=getInstance]
rename_classes = CCParticleSystemQuad::CCParticleSystem,
SimpleAudioEngine::AudioEngine,
CCBReader::CC_Reader,