Merge pull request #596 from pandamicro/develop

Reverse pure JS Action, reuse JSB Action
This commit is contained in:
pandamicro
2017-04-23 03:17:11 +08:00
committed by GitHub
15 changed files with 1486 additions and 22 deletions
+12
View File
@@ -48,6 +48,16 @@ Action::Action()
#endif
}
void Action::sendUpdateEventToScript(float dt, Action *actionObject)
{
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript)
{
ScriptEngineManager::sendActionEventToJS(actionObject, kActionUpdate, (void *)&dt);
}
#endif
}
Action::~Action()
{
CCLOGINFO("deallocing Action: %p - tag: %i", this, _tag);
@@ -326,6 +336,8 @@ void Follow::step(float dt)
{
_target->setPosition(tempPos);
}
sendUpdateEventToScript(dt, this);
}
bool Follow::isDone() const
+2
View File
@@ -183,6 +183,8 @@ protected:
#endif
private:
CC_DISALLOW_COPY_AND_ASSIGN(Action);
protected:
void sendUpdateEventToScript(float dt, Action *actionObject);
};
/** @class FiniteTimeAction
+7
View File
@@ -49,6 +49,13 @@ void ActionInstant::step(float dt)
{
CC_UNUSED_PARAM(dt);
float updateDt = 1;
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript)
{
if (ScriptEngineManager::sendActionEventToJS(this, kActionUpdate, (void *)&updateDt))
return;
}
#endif
update(updateDt);
}
+40 -13
View File
@@ -104,6 +104,18 @@ bool ActionInterval::initWithDuration(float d)
return true;
}
bool ActionInterval::sendUpdateEventToScript(float dt, Action *actionObject)
{
#if CC_ENABLE_SCRIPT_BINDING
if (_scriptType == kScriptTypeJavascript)
{
if (ScriptEngineManager::sendActionEventToJS(actionObject, kActionUpdate, (void *)&dt))
return true;
}
#endif
return false;
}
bool ActionInterval::isDone() const
{
return _elapsed >= _duration;
@@ -126,6 +138,8 @@ void ActionInterval::step(float dt)
MIN(1, _elapsed / _duration)
);
if (sendUpdateEventToScript(updateDt, this)) return;
this->update(updateDt);
}
@@ -379,13 +393,15 @@ void Sequence::update(float t)
{
// action[0] was skipped, execute it.
_actions[0]->startWithTarget(_target);
_actions[0]->update(1.0f);
if (!(sendUpdateEventToScript(1.0f, _actions[0])))
_actions[0]->update(1.0f);
_actions[0]->stop();
}
else if( _last == 0 )
{
// switching to action 1. stop action 0.
_actions[0]->update(1.0f);
if (!(sendUpdateEventToScript(1.0f, _actions[0])))
_actions[0]->update(1.0f);
_actions[0]->stop();
}
}
@@ -395,7 +411,8 @@ void Sequence::update(float t)
// FIXME: Bug. this case doesn't contemplate when _last==-1, found=0 and in "reverse mode"
// since it will require a hack to know if an action is on reverse mode or not.
// "step" should be overridden, and the "reverseMode" value propagated to inner Sequences.
_actions[1]->update(0);
if (!(sendUpdateEventToScript(0, _actions[1])))
_actions[1]->update(0);
_actions[1]->stop();
}
// Last action found and it is done.
@@ -409,7 +426,8 @@ void Sequence::update(float t)
{
_actions[found]->startWithTarget(_target);
}
_actions[found]->update(new_t);
if (!(sendUpdateEventToScript(new_t, _actions[found])))
_actions[found]->update(new_t);
_last = found;
}
@@ -503,7 +521,8 @@ void Repeat::update(float dt)
{
while (dt >= _nextDt && _total < _times)
{
_innerAction->update(1.0f);
if (!(sendUpdateEventToScript(1.0f, _innerAction)))
_innerAction->update(1.0f);
_total++;
_innerAction->stop();
@@ -514,7 +533,8 @@ void Repeat::update(float dt)
// fix for issue #1288, incorrect end value of repeat
if (std::abs(dt - 1.0f) < FLT_EPSILON && _total < _times)
{
_innerAction->update(1.0f);
if (!(sendUpdateEventToScript(1.0f, _innerAction)))
_innerAction->update(1.0f);
_total++;
}
@@ -525,19 +545,22 @@ void Repeat::update(float dt)
if (_total == _times)
{
// minggo: inner action update is invoked above, don't have to invoke it here
// _innerAction->update(1);
// if (!(sendUpdateEventToScript(1, _innerAction)))
// _innerAction->update(1);
_innerAction->stop();
}
else
{
// issue #390 prevent jerk, use right update
_innerAction->update(dt - (_nextDt - _innerAction->getDuration()/_duration));
if (!(sendUpdateEventToScript(dt - (_nextDt - _innerAction->getDuration()/_duration), _innerAction)))
_innerAction->update(dt - (_nextDt - _innerAction->getDuration()/_duration));
}
}
}
else
{
_innerAction->update(fmodf(dt * _times,1.0f));
if (!(sendUpdateEventToScript(fmodf(dt * _times,1.0f), _innerAction)))
_innerAction->update(fmodf(dt * _times,1.0f));
}
}
@@ -846,11 +869,13 @@ void Spawn::update(float time)
{
if (_one)
{
_one->update(time);
if (!(sendUpdateEventToScript(time, _one)))
_one->update(time);
}
if (_two)
{
_two->update(time);
if (!(sendUpdateEventToScript(time, _two)))
_two->update(time);
}
}
@@ -2255,7 +2280,8 @@ void ReverseTime::update(float time)
{
if (_other)
{
_other->update(1 - time);
if (!(sendUpdateEventToScript(1 - time, _other)))
_other->update(1 - time);
}
}
@@ -2539,7 +2565,8 @@ void TargetedAction::stop()
void TargetedAction::update(float time)
{
_action->update(time);
if (!(sendUpdateEventToScript(time, _action)))
_action->update(time);
}
void TargetedAction::setForcedTarget(Node* forcedTarget)
+3
View File
@@ -115,6 +115,9 @@ CC_CONSTRUCTOR_ACCESS:
protected:
float _elapsed;
bool _firstTick;
protected:
bool sendUpdateEventToScript(float dt, Action *actionObject);
};
/** @class Sequence
+12
View File
@@ -163,6 +163,18 @@ void ScriptEngineManager::destroyInstance()
}
}
bool ScriptEngineManager::sendActionEventToJS(Action* actionObject, int eventType, void* param)
{
auto scriptEngine = getInstance()->getScriptEngine();
ActionObjectScriptData data(actionObject,(int*)&eventType, param);
ScriptEvent scriptEvent(kScriptActionEvent,(void*)&data);
if (scriptEngine->sendEvent(&scriptEvent))
return true;
return false;
}
bool ScriptEngineManager::sendNodeEventToJS(Node* node, int action)
{
auto scriptEngine = getInstance()->getScriptEngine();
+7
View File
@@ -869,6 +869,13 @@ public:
* @js NA
*/
static void destroyInstance();
/**
*
*
* @lua NA
* @js NA
*/
static bool sendActionEventToJS(Action* actionObject, int eventType, void* param);
/**
*
*
@@ -1287,6 +1287,38 @@ bool ScriptingCore::isFunctionOverridedInJS(JS::HandleObject obj, const std::str
return false;
}
int ScriptingCore::handleActionEvent(void* data)
{
if (NULL == data)
return 0;
ActionObjectScriptData* actionObjectScriptData = static_cast<ActionObjectScriptData*>(data);
if (NULL == actionObjectScriptData->nativeObject || NULL == actionObjectScriptData->eventType)
return 0;
Action* actionObject = static_cast<Action*>(actionObjectScriptData->nativeObject);
int eventType = *((int*)(actionObjectScriptData->eventType));
js_proxy_t * p = jsb_get_native_proxy(actionObject);
if (!p) return 0;
JSAutoCompartment ac(_cx, _global->get());
int ret = 0;
JS::RootedValue retval(_cx);
if (eventType == kActionUpdate)
{
JS::RootedObject jstarget(_cx, p->obj);
if (isFunctionOverridedInJS(jstarget, "update", js_cocos2dx_Action_update))
{
jsval dataVal = DOUBLE_TO_JSVAL(*((float *)actionObjectScriptData->param));
ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "update", 1, &dataVal, &retval);
}
}
return ret;
}
int ScriptingCore::handleNodeEvent(void* data)
{
if (NULL == data)
@@ -1717,6 +1749,11 @@ int ScriptingCore::sendEvent(ScriptEvent* evt)
return handleNodeEvent(evt->data);
}
break;
case kScriptActionEvent:
{
return handleActionEvent(evt->data);
}
break;
case kMenuClickedEvent:
break;
case kTouchEvent:
@@ -558,6 +558,7 @@ private:
public:
int handleNodeEvent(void* data);
int handleActionEvent(void* data);
int handleComponentEvent(void* data);
bool handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::EventCode eventCode, const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
@@ -24,6 +24,12 @@
#include "scripting/js-bindings/manual/cocos2d_specifics.hpp"
#include <typeinfo>
#include "2d/CCAction.h"
#include "2d/CCActionCatmullRom.h"
#include "2d/CCActionEase.h"
#include "2d/CCActionInstant.h"
#include "2d/CCActionInterval.h"
#include "2d/CCActionTween.h"
#include "2d/CCClippingNode.h"
#include "2d/CCMenu.h"
#include "2d/CCNodeGrid.h"
@@ -340,6 +346,82 @@ bool js_cocos2dx_CCMenu_create(JSContext *cx, uint32_t argc, jsval *vp)
return false;
}
bool js_cocos2dx_CCSequence_create(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc > 0) {
Vector<FiniteTimeAction*> array;
JS::RootedObject actions(cx, args.get(0).toObjectOrNull());
if (argc == 1 && JS_IsArrayObject(cx, actions)) {
bool ok = true;
ok &= jsval_to_ccvector(cx, args.get(0), &array);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
} else {
uint32_t i = 0;
while (i < argc) {
js_proxy_t *proxy;
JS::RootedObject tmpObj(cx, args.get(i).toObjectOrNull());
proxy = jsb_get_js_proxy(tmpObj);
cocos2d::FiniteTimeAction *item = (cocos2d::FiniteTimeAction*)(proxy ? proxy->ptr : nullptr);
TEST_NATIVE_OBJECT(cx, item)
array.pushBack(item);
i++;
}
}
auto ret = new (std::nothrow) cocos2d::Sequence;
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Sequence>(ret);
// link the native object with the javascript object
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, ret, typeClass, "cocos2d::Sequence"));
auto ok = ret->init(array);
if (ok)
{
args.rval().set(OBJECT_TO_JSVAL(jsobj));
return true;
}
}
JS_ReportError(cx, "wrong number of arguments");
return false;
}
bool js_cocos2dx_CCSpawn_create(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc > 0) {
Vector<FiniteTimeAction*> array;
JS::RootedObject actions(cx, args.get(0).toObjectOrNull());
if (argc == 1 && JS_IsArrayObject(cx, actions)) {
bool ok = true;
ok &= jsval_to_ccvector(cx, args.get(0), &array);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
} else {
uint32_t i = 0;
while (i < argc) {
js_proxy_t *proxy;
JS::RootedObject tmpObj(cx, args[i].toObjectOrNull());
proxy = jsb_get_js_proxy(tmpObj);
cocos2d::FiniteTimeAction *item = (cocos2d::FiniteTimeAction*)(proxy ? proxy->ptr : nullptr);
TEST_NATIVE_OBJECT(cx, item)
array.pushBack(item);
i++;
}
}
auto ret = new (std::nothrow) cocos2d::Spawn;
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Spawn>(ret);
// link the native object with the javascript object
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, ret, typeClass, "cocos2d::Spawn"));
auto ok = ret->init(array);
if (ok)
{
args.rval().set(OBJECT_TO_JSVAL(jsobj));
return true;
}
}
JS_ReportError(cx, "wrong number of arguments");
return false;
}
// TODO: This function is deprecated. The new API is "new MenuItemToggle" instead of "MenuItemToggle.create"
// There are not js tests for this function. Impossible to know weather it works Ok.
bool js_cocos2dx_CCMenuItemToggle_create(JSContext *cx, uint32_t argc, jsval *vp)
@@ -757,6 +839,140 @@ const jsval JSCallbackWrapper::getJSExtraData() const
return _extraData;
}
// cc.CallFunc.create( func, this, [data])
// cc.CallFunc.create( func )
static bool js_callFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
if (argc >= 1 && argc <= 3) {
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
cocos2d::CallFuncN *ret = new (std::nothrow) cocos2d::CallFuncN;
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::CallFuncN>(ret);
// link the native object with the javascript object
JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, ret, typeClass, "cocos2d::CallFuncN"));
JS::RootedValue retVal(cx, OBJECT_TO_JSVAL(jsobj));
std::shared_ptr<JSCallbackWrapper> tmpCobj(new JSCallbackWrapper(retVal));
JS::RootedValue callback(cx, args.get(0));
tmpCobj->setJSCallbackFunc(callback);
if (argc >= 2)
{
JS::RootedValue thisObj(cx, args.get(1));
tmpCobj->setJSCallbackThis(thisObj);
}
if (argc >= 3)
{
JS::RootedValue data(cx, args.get(2));
tmpCobj->setJSExtraData(data);
}
bool ok = ret->initWithFunction([=](Node* sender){
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JS::RootedValue jsvalThis(cx, tmpCobj->getJSCallbackThis());
JS::RootedObject thisObj(cx, jsvalThis.toObjectOrNull());
JS::RootedValue jsvalCallback(cx, tmpCobj->getJSCallbackFunc());
JS::RootedValue jsvalExtraData(cx, tmpCobj->getJSExtraData());
JS::RootedValue senderVal(cx);
if (sender == nullptr)
{
sender = ret->getTarget();
}
if(sender)
{
js_type_class_t *nodeClass = js_get_type_from_native<cocos2d::Node>(sender);
auto nodeObj = jsb_ref_get_or_create_jsobject(cx, sender, nodeClass, "cocos2d::Node");
senderVal.set(OBJECT_TO_JSVAL(nodeObj));
}
else
{
senderVal.set(JS::NullValue());
}
if (!jsvalCallback.isNullOrUndefined())
{
JS::RootedValue retval(cx);
jsval valArr[2];
valArr[0] = senderVal;
valArr[1] = jsvalExtraData;
JS::HandleValueArray callArgs = JS::HandleValueArray::fromMarkedLocation(2, valArr);
JS_CallFunctionValue(cx, thisObj, jsvalCallback, callArgs, &retval);
}
});
if (ok)
{
args.rval().set(retVal);
return true;
}
return true;
}
JS_ReportError(cx, "js_callFunc: Invalid number of arguments");
return false;
}
// callFunc.initWithFunction( func, this, [data])
// callFunc.initWithFunction( func )
bool js_cocos2dx_CallFunc_initWithFunction(JSContext *cx, uint32_t argc, jsval *vp)
{
if (argc >= 1 && argc <= 3) {
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
CallFuncN *action = (cocos2d::CallFuncN *)(proxy ? proxy->ptr : nullptr);
JSB_PRECONDITION2(action, cx, false, "Invalid Native Object");
std::shared_ptr<JSCallbackWrapper> tmpCobj(new JSCallbackWrapper(args.thisv()));
JS::RootedValue callback(cx, args.get(0));
tmpCobj->setJSCallbackFunc(callback);
if(argc >= 2) {
JS::RootedValue thisObj(cx, args.get(1));
tmpCobj->setJSCallbackThis(thisObj);
}
if(argc >= 3) {
JS::RootedValue data(cx, args.get(2));
tmpCobj->setJSExtraData(data);
}
action->initWithFunction([=](Node* sender){
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JS::RootedValue jsvalThis(cx, tmpCobj->getJSCallbackThis());
JS::RootedObject thisObj(cx, jsvalThis.toObjectOrNull());
JS::RootedValue jsvalCallback(cx, tmpCobj->getJSCallbackFunc());
JS::RootedValue jsvalExtraData(cx, tmpCobj->getJSExtraData());
JS::RootedValue senderVal(cx);
if (sender)
{
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::Node>(sender);
auto jsobj = jsb_ref_get_or_create_jsobject(cx, sender, typeClass, "cocos2d::Node");
senderVal.set(OBJECT_TO_JSVAL(jsobj));
}
else
{
senderVal.set(JS::NullValue());
}
if (!jsvalCallback.isNullOrUndefined())
{
JS::RootedValue retval(cx);
jsval valArr[2];
valArr[0] = senderVal;
valArr[1] = jsvalExtraData;
JS::HandleValueArray callArgs = JS::HandleValueArray::fromMarkedLocation(2, valArr);
JS_CallFunctionValue(cx, thisObj, jsvalCallback, callArgs, &retval);
}
});
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
JSScheduleWrapper::JSScheduleWrapper()
: JSCallbackWrapper()
, _pTarget(nullptr)
@@ -2523,6 +2739,660 @@ bool js_cocos2dx_CCTMXLayer_getTiles(JSContext *cx, uint32_t argc, jsval *vp)
return false;
}
// Actions
bool js_cocos2dx_ActionInterval_repeat(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : nullptr);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_repeat : Invalid Native Object");
if (argc == 1)
{
double times;
if( ! JS::ToNumber(cx, args.get(0), &times) ) {
return false;
}
int timesInt = (int)times;
if (timesInt <= 0) {
JS_ReportError(cx, "js_cocos2dx_ActionInterval_repeat : Repeat times must be greater than 0");
}
cocos2d::Repeat* action = new (std::nothrow) cocos2d::Repeat;
action->initWithAction(cobj, timesInt);
jsb_ref_rebind(cx, obj, proxy, cobj, action, "cocos2d::Repeat");
args.rval().set(OBJECT_TO_JSVAL(obj));
return true;
}
JS_ReportError(cx, "js_cocos2dx_ActionInterval_repeat : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_ActionInterval_repeatForever(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject jsobj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(jsobj);
cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : nullptr);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_repeatForever : Invalid Native Object");
if (argc == 0) {
cocos2d::RepeatForever* action = new (std::nothrow) cocos2d::RepeatForever;
action->initWithAction(cobj);
jsb_ref_rebind(cx, jsobj, proxy, cobj, action, "cocos2d::RepeatForever");
args.rval().set(OBJECT_TO_JSVAL(jsobj));
return true;
}
JS_ReportError(cx, "js_cocos2dx_ActionInterval_repeatForever : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ActionInterval_speed(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : nullptr);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ActionInterval_speed : Invalid Native Object");
if (argc == 1)
{
double speed;
if( ! JS::ToNumber(cx, args.get(0), &speed) ) {
return false;
}
if (speed < 0) {
JS_ReportError(cx, "js_cocos2dx_ActionInterval_speed : Speed must not be negative");
return false;
}
cocos2d::Speed* action = new (std::nothrow) cocos2d::Speed;
action->initWithAction(cobj, speed);
jsb_ref_rebind(cx, obj, proxy, cobj, action, "cocos2d::Speed");
args.rval().set(OBJECT_TO_JSVAL(obj));
return true;
}
JS_ReportError(cx, "js_cocos2dx_ActionInterval_speed : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
enum ACTION_TAG {
EASE_IN = 0,
EASE_OUT,
EASE_INOUT,
EASE_EXPONENTIAL_IN,
EASE_EXPONENTIAL_OUT,
EASE_EXPONENTIAL_INOUT,
EASE_SINE_IN,
EASE_SINE_OUT,
EASE_SINE_INOUT,
EASE_ELASTIC_IN,
EASE_ELASTIC_OUT,
EASE_ELASTIC_INOUT,
EASE_BOUNCE_IN,
EASE_BOUNCE_OUT,
EASE_BOUNCE_INOUT,
EASE_BACK_IN,
EASE_BACK_OUT,
EASE_BACK_INOUT,
EASE_BEZIER_ACTION,
EASE_QUADRATIC_IN,
EASE_QUADRATIC_OUT,
EASE_QUADRATIC_INOUT,
EASE_QUARTIC_IN,
EASE_QUARTIC_OUT,
EASE_QUARTIC_INOUT,
EASE_QUINTIC_IN,
EASE_QUINTIC_OUT,
EASE_QUINTIC_INOUT,
EASE_CIRCLE_IN,
EASE_CIRCLE_OUT,
EASE_CIRCLE_INOUT,
EASE_CUBIC_IN,
EASE_CUBIC_OUT,
EASE_CUBIC_INOUT
};
bool js_cocos2dx_ActionInterval_easing(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject jsobj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(jsobj);
cocos2d::ActionInterval* oldAction = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2 (oldAction, cx, false, "js_cocos2dx_ActionInterval_easing : Invalid Native Object");
cocos2d::ActionInterval* newAction = nullptr;
JS::RootedObject tmp(cx);
JS::RootedValue jsTag(cx);
JS::RootedValue jsParam(cx);
double tag;
double parameter;
for (uint32_t i = 0; i < argc; i++)
{
JS::RootedValue vpi(cx, args.get(i));
bool ok = vpi.isObject() &&
JS_ValueToObject(cx, vpi, &tmp) &&
JS_GetProperty(cx, tmp, "tag", &jsTag) &&
JS::ToNumber(cx, jsTag, &tag);
JS_GetProperty(cx, tmp, "param", &jsParam) && JS::ToNumber(cx, jsParam, &parameter);
bool hasParam = (parameter == parameter);
if (!ok) continue;
ok = true;
if (tag == EASE_IN)
{
if (!hasParam) ok = false;
auto tmpaction = new (std::nothrow) cocos2d::EaseIn;
tmpaction->initWithAction(oldAction, parameter);
newAction = tmpaction;
}
else if (tag == EASE_OUT)
{
if (!hasParam) ok = false;
auto tmpaction = new (std::nothrow) cocos2d::EaseOut;
tmpaction->initWithAction(oldAction, parameter);
newAction = tmpaction;
}
else if (tag == EASE_INOUT)
{
if (!hasParam) ok = false;
auto tmpaction = new (std::nothrow) cocos2d::EaseInOut;
tmpaction->initWithAction(oldAction, parameter);
newAction = tmpaction;
}
else if (tag == EASE_EXPONENTIAL_IN)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseExponentialIn;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_EXPONENTIAL_OUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseExponentialOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_EXPONENTIAL_INOUT)
{
auto tmpaction = new (std::nothrow)cocos2d::EaseExponentialInOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_SINE_IN)
{
auto tmpaction = new (std::nothrow)cocos2d::EaseSineIn;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_SINE_OUT)
{
auto tmpaction = new (std::nothrow)cocos2d::EaseSineOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_SINE_INOUT)
{
auto tmpaction = new (std::nothrow)cocos2d::EaseSineInOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_ELASTIC_IN)
{
if (!hasParam) parameter = 0.3;
auto tmpaction = new (std::nothrow)cocos2d::EaseElasticIn;
tmpaction->initWithAction(oldAction, parameter);
newAction = tmpaction;
}
else if (tag == EASE_ELASTIC_OUT)
{
if (!hasParam) parameter = 0.3;
auto tmpaction = new (std::nothrow)cocos2d::EaseElasticOut;
tmpaction->initWithAction(oldAction, parameter);
newAction = tmpaction;
}
else if (tag == EASE_ELASTIC_INOUT)
{
if (!hasParam) parameter = 0.3;
auto tmpaction = new (std::nothrow)cocos2d::EaseElasticInOut;
tmpaction->initWithAction(oldAction, parameter);
newAction = tmpaction;
}
else if (tag == EASE_BOUNCE_IN)
{
auto tmpaction = new (std::nothrow)cocos2d::EaseBounceIn;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_BOUNCE_OUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseBounceOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_BOUNCE_INOUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseBounceInOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_BACK_IN)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseBackIn;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_BACK_OUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseBackOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_BACK_INOUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseBackInOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_QUADRATIC_IN)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseQuadraticActionIn;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_QUADRATIC_OUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseQuadraticActionOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_QUADRATIC_INOUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseQuadraticActionInOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_QUARTIC_IN)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseQuarticActionIn;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_QUARTIC_OUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseQuarticActionOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_QUARTIC_INOUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseQuarticActionInOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_QUINTIC_IN)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseQuinticActionIn;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_QUINTIC_OUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseQuinticActionOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_QUINTIC_INOUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseQuinticActionInOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_CIRCLE_IN)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseCircleActionIn;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_CIRCLE_OUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseCircleActionOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_CIRCLE_INOUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseCircleActionInOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_CUBIC_IN)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseCubicActionIn;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_CUBIC_OUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseCubicActionOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_CUBIC_INOUT)
{
auto tmpaction = new (std::nothrow) cocos2d::EaseCubicActionInOut;
tmpaction->initWithAction(oldAction);
newAction = tmpaction;
}
else if (tag == EASE_BEZIER_ACTION)
{
JS::RootedValue jsParam2(cx);
JS::RootedValue jsParam3(cx);
JS::RootedValue jsParam4(cx);
double parameter2, parameter3, parameter4;
ok &= JS_GetProperty(cx, tmp, "param2", &jsParam2);
ok &= JS::ToNumber(cx, jsParam2, &parameter2);
ok &= JS_GetProperty(cx, tmp, "param3", &jsParam3);
ok &= JS::ToNumber(cx, jsParam3, &parameter3);
ok &= JS_GetProperty(cx, tmp, "param4", &jsParam4);
ok &= JS::ToNumber(cx, jsParam4, &parameter4);
if (!ok) continue;
auto tmpaction = new (std::nothrow) cocos2d::EaseBezierAction;
tmpaction->initWithAction(oldAction);
tmpaction->setBezierParamer(parameter, parameter2, parameter3, parameter4);
newAction = tmpaction;
}
else
continue;
if (!ok || !newAction) {
JS_ReportError(cx, "js_cocos2dx_ActionInterval_easing : Invalid action: At least one action was expecting parameter");
return false;
}
}
// Unbind existing proxy binding with cobj, and rebind with the new action
jsb_ref_rebind(cx, jsobj, proxy, oldAction, newAction, "cocos2d::EaseAction");
args.rval().set(OBJECT_TO_JSVAL(jsobj));
return true;
}
template<class T>
bool js_BezierActions_create(JSContext *cx, uint32_t argc, jsval *vp) {
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
if (argc == 2) {
double t;
if( ! JS::ToNumber(cx, args.get(0), &t) ) {
return false;
}
int num;
Point *arr;
jsval_to_ccarray_of_CCPoint(cx, args.get(1), &arr, &num);
ccBezierConfig config;
config.controlPoint_1 = arr[0];
config.controlPoint_2 = arr[1];
config.endPosition = arr[2];
T* ret = new (std::nothrow) T;
ret->initWithDuration(t, config);
delete [] arr;
JSObject* jsobj;
js_type_class_t *typeProxy = js_get_type_from_native<T>(ret);
jsobj = jsb_ref_create_jsobject(cx, ret, typeProxy, typeid(*ret).name());
args.rval().set(OBJECT_TO_JSVAL(jsobj));
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
template<class T>
bool js_BezierActions_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
T* cobj = (T *)(proxy ? proxy->ptr : nullptr);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Bezier_initWithDuration : Invalid Native Object");
if (argc == 2) {
double arg0;
cocos2d::_ccBezierConfig arg1;
ok &= JS::ToNumber(cx, args.get(0), &arg0);
int num;
cocos2d::Vec2 *arr;
jsval_to_ccarray_of_CCPoint(cx, args.get(1), &arr, &num);
arg1.controlPoint_1 = arr[0];
arg1.controlPoint_2 = arr[1];
arg1.endPosition = arr[2];
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Bezier_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1);
delete [] arr;
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_BezierTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
return false;
}
template<class T>
bool js_CardinalSplineActions_create(JSContext *cx, uint32_t argc, jsval *vp) {
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 3) {
double dur;
ok &= JS::ToNumber(cx, args.get(0), &dur);
int num;
Point *arr;
ok &= jsval_to_ccarray_of_CCPoint(cx, args.get(1), &arr, &num);
double ten;
ok &= JS::ToNumber(cx, args.get(2), &ten);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
PointArray *points = PointArray::create(num);
for( int i=0; i < num;i++) {
points->addControlPoint(arr[i]);
}
T *ret = new (std::nothrow) T;
ret->initWithDuration(dur, points, ten);
delete [] arr;
JSObject* jsobj;
js_type_class_t *typeProxy = js_get_type_from_native<T>(ret);
jsobj = jsb_ref_create_jsobject(cx, ret, typeProxy, typeid(*ret).name());
args.rval().set(OBJECT_TO_JSVAL(jsobj));
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
template<class T>
bool js_CatmullRomActions_create(JSContext *cx, uint32_t argc, jsval *vp) {
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
if (argc == 2) {
double dur;
ok &= JS::ToNumber(cx, args.get(0), &dur);
int num;
Point *arr;
ok &= jsval_to_ccarray_of_CCPoint(cx, args.get(1), &arr, &num);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
PointArray *points = PointArray::create(num);
for( int i=0; i < num;i++) {
points->addControlPoint(arr[i]);
}
T *ret = new (std::nothrow) T;
ret->initWithDuration(dur, points);
delete [] arr;
JSObject* jsobj;
js_type_class_t *typeProxy = js_get_type_from_native<T>(ret);
jsobj = jsb_ref_create_jsobject(cx, ret, typeProxy, typeid(*ret).name());
args.rval().set(OBJECT_TO_JSVAL(jsobj));
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
template<class T>
bool js_CatmullRomActions_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp) {
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
T* cobj = (T *)(proxy ? proxy->ptr : nullptr);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CatmullRom_initWithDuration : Invalid Native Object");
if (argc == 2) {
double arg0;
JS::RootedValue jsarg0(cx, args.get(0));
ok &= JS::ToNumber(cx, jsarg0, &arg0);
int num;
Point *arr;
ok &= jsval_to_ccarray_of_CCPoint(cx, args.get(1), &arr, &num);
cocos2d::PointArray* arg1 = cocos2d::PointArray::create(num);
for( int i=0; i < num;i++) {
arg1->addControlPoint(arr[i]);
}
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CatmullRom_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1);
delete [] arr;
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_CatmullRom_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 2);
return false;
}
bool JSB_CCBezierBy_actionWithDuration(JSContext *cx, uint32_t argc, jsval *vp) {
return js_BezierActions_create<cocos2d::BezierBy>(cx, argc, vp);
}
bool JSB_CCBezierTo_actionWithDuration(JSContext *cx, uint32_t argc, jsval *vp) {
return js_BezierActions_create<cocos2d::BezierTo>(cx, argc, vp);
}
bool JSB_CCBezierBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_BezierActions_initWithDuration<cocos2d::BezierBy>(cx, argc, vp);
}
bool JSB_CCBezierTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_BezierActions_initWithDuration<cocos2d::BezierTo>(cx, argc, vp);
}
bool JSB_CCCardinalSplineBy_actionWithDuration(JSContext *cx, uint32_t argc, jsval *vp) {
return js_CardinalSplineActions_create<cocos2d::CardinalSplineBy>(cx, argc, vp);
}
bool JSB_CCCardinalSplineTo_actionWithDuration(JSContext *cx, uint32_t argc, jsval *vp) {
return js_CardinalSplineActions_create<cocos2d::CardinalSplineTo>(cx, argc, vp);
}
bool js_cocos2dx_CardinalSplineTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
bool ok = true;
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::CardinalSplineTo* cobj = (cocos2d::CardinalSplineTo *)(proxy ? proxy->ptr : nullptr);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_CardinalSplineTo_initWithDuration : Invalid Native Object");
if (argc == 3) {
double arg0;
double arg2;
JS::RootedValue jsarg0(cx, args.get(0));
ok &= JS::ToNumber(cx, jsarg0, &arg0);
int num;
Point *arr;
ok &= jsval_to_ccarray_of_CCPoint(cx, args.get(1), &arr, &num);
cocos2d::PointArray* arg1 = PointArray::create(num);
for( int i=0; i < num;i++) {
arg1->addControlPoint(arr[i]);
}
JS::RootedValue jsarg2(cx, args.get(2));
ok &= JS::ToNumber(cx, jsarg2, &arg2);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_CardinalSplineTo_initWithDuration : Error processing arguments");
bool ret = cobj->initWithDuration(arg0, arg1, arg2);
delete [] arr;
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_CardinalSplineTo_initWithDuration : wrong number of arguments: %d, was expecting %d", argc, 3);
return false;
}
bool JSB_CCCatmullRomBy_actionWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_CatmullRomActions_create<cocos2d::CatmullRomBy>(cx, argc, vp);
}
bool JSB_CCCatmullRomTo_actionWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_CatmullRomActions_create<cocos2d::CatmullRomTo>(cx, argc, vp);
}
bool JSB_CatmullRomBy_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_CatmullRomActions_initWithDuration<cocos2d::CatmullRomBy>(cx, argc, vp);
}
bool JSB_CatmullRomTo_initWithDuration(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_CatmullRomActions_initWithDuration<cocos2d::CatmullRomTo>(cx, argc, vp);
}
bool js_cocos2dx_ccGLEnableVertexAttribs(JSContext *cx, uint32_t argc, jsval *vp)
{
bool ok = true;
@@ -4600,6 +5470,10 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
JS_DefineFunction(cx, tmpObj, "pauseAllTargetsWithMinPriority", js_cocos2dx_CCScheduler_pauseAllTargetsWithMinPriority, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "resumeTargets", js_cocos2dx_CCScheduler_resumeTargets, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_ActionManager_prototype);
JS_DefineFunction(cx, tmpObj, "retain", js_cocos2dx_retain, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "release", js_cocos2dx_release, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_TMXLayer_prototype);
JS_DefineFunction(cx, tmpObj, "getTileFlagsAt", js_cocos2dx_CCTMXLayer_getTileFlagsAt, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
@@ -4655,6 +5529,40 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", js_EventListenerCustom_create, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "BezierBy", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", JSB_CCBezierBy_actionWithDuration, 2, JSPROP_READONLY | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_BezierBy_prototype);
JS_DefineFunction(cx, tmpObj, "initWithDuration", JSB_CCBezierBy_initWithDuration, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "BezierTo", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", JSB_CCBezierTo_actionWithDuration, 2, JSPROP_READONLY | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_BezierTo_prototype);
JS_DefineFunction(cx, tmpObj, "initWithDuration", JSB_CCBezierTo_initWithDuration, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "CardinalSplineBy", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", JSB_CCCardinalSplineBy_actionWithDuration, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "CardinalSplineTo", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", JSB_CCCardinalSplineTo_actionWithDuration, 2, JSPROP_READONLY | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_CardinalSplineTo_prototype);
JS_DefineFunction(cx, tmpObj, "initWithDuration", js_cocos2dx_CardinalSplineTo_initWithDuration, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "CatmullRomBy", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", JSB_CCCatmullRomBy_actionWithDuration, 2, JSPROP_READONLY | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_CatmullRomBy_prototype);
JS_DefineFunction(cx, tmpObj, "initWithDuration", JSB_CatmullRomBy_initWithDuration, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "CatmullRomTo", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", JSB_CCCatmullRomTo_actionWithDuration, 2, JSPROP_READONLY | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_CatmullRomTo_prototype);
JS_DefineFunction(cx, tmpObj, "initWithDuration", JSB_CatmullRomBy_initWithDuration, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_Sprite_prototype);
JS_DefineFunction(cx, tmpObj, "initWithPolygon", js_cocos2dx_Sprite_initWithPolygon, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "setPolygonInfo", js_cocos2dx_Sprite_setPolygonInfo, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
@@ -4662,6 +5570,9 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
tmpObj.set(jsb_cocos2d_SpriteBatchNode_prototype);
JS_DefineFunction(cx, tmpObj, "getDescendants", js_cocos2dx_SpriteBatchNode_getDescendants, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_Action_prototype);
JS_DefineFunction(cx, tmpObj, "retain", js_cocos2dx_retain, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "release", js_cocos2dx_release, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_SpriteFrame_prototype);
JS_DefineFunction(cx, tmpObj, "retain", js_cocos2dx_retain, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "release", js_cocos2dx_release, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
@@ -4670,6 +5581,12 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
tmpObj.set(jsb_cocos2d_TMXLayer_prototype);
JS_DefineFunction(cx, tmpObj, "getTiles", js_cocos2dx_CCTMXLayer_getTiles, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_ActionInterval_prototype);
JS_DefineFunction(cx, tmpObj, "repeat", js_cocos2dx_ActionInterval_repeat, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "repeatForever", js_cocos2dx_ActionInterval_repeatForever, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "_speed", js_cocos2dx_ActionInterval_speed, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "easing", js_cocos2dx_ActionInterval_easing, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_RenderTexture_prototype);
JS_DefineFunction(cx, tmpObj, "saveToFile", js_cocos2dx_RenderTexture_saveToFile, 4, JSPROP_ENUMERATE | JSPROP_PERMANENT);
@@ -4679,10 +5596,21 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
JS_GetProperty(cx, ccObj, "MenuItemToggle", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "_create", js_cocos2dx_CCMenuItemToggle_create, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "Sequence", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_CCSequence_create, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_GetProperty(cx, ccObj, "Spawn", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_CCSpawn_create, 0, JSPROP_READONLY | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_Scene_prototype);
JS_DefineFunction(cx, tmpObj, "init", js_cocos2dx_CCScene_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE);
JS_GetProperty(cx, ccObj, "CallFunc", &tmpVal);
tmpObj = tmpVal.toObjectOrNull();
JS_DefineFunction(cx, tmpObj, "create", js_callFunc, 1, JSPROP_READONLY | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_CallFuncN_prototype);
JS_DefineFunction(cx, tmpObj, "initWithFunction", js_cocos2dx_CallFunc_initWithFunction, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_ClippingNode_prototype);
JS_DefineFunction(cx, tmpObj, "init", js_cocos2dx_ClippingNode_init, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
@@ -31,6 +31,7 @@
// Define singleton objects
cc.director = cc.Director.getInstance();
cc.director._actionManager = cc.director.getActionManager();
cc.director._scheduler = cc.director.getScheduler();
cc.winSize = cc.director.getWinSize();
@@ -697,6 +697,211 @@ for (var i = 0, l = protoHasBlend.length; i < l; i++) {
}
//
// Ease actions JS API Wrapper
//
var easeActions = {
easeIn : 0,
easeOut : 1,
easeInOut : 2,
easeExponentialIn : 3,
easeExponentialOut : 4,
easeExponentialInOut : 5,
easeSineIn : 6,
easeSineOut : 7,
easeSineInOut : 8,
easeElasticIn : 9,
easeElasticOut : 10,
easeElasticInOut : 11,
easeBounceIn : 12,
easeBounceOut : 13,
easeBounceInOut : 14,
easeBackIn : 15,
easeBackOut : 16,
easeBackInOut : 17,
easeBezierAction : 18,
easeQuadraticActionIn : 19,
easeQuadraticActionOut : 20,
easeQuadraticActionInOut : 21,
easeQuarticActionIn : 22,
easeQuarticActionOut : 23,
easeQuarticActionInOut : 24,
easeQuinticActionIn : 25,
easeQuinticActionOut : 26,
easeQuinticActionInOut : 27,
easeCircleActionIn : 28,
easeCircleActionOut : 29,
easeCircleActionInOut : 30,
easeCubicActionIn : 31,
easeCubicActionOut : 32,
easeCubicActionInOut : 33
};
function templateEaseActions(actionTag) {
return function(param, param2, param3, param4) {
return {tag: actionTag, param: param, param2: param2, param3: param3, param4: param4};
}
}
for (var a in easeActions) {
var actionTag = easeActions[a];
cc[a] = templateEaseActions(actionTag);
}
// Action2d
cc.action = cc.Action.create;
cc.speed = cc.Speed.create;
cc.follow = cc.Follow.create;
cc.cardinalSplineTo = cc.CardinalSplineTo.create;
cc.cardinalSplineBy = cc.CardinalSplineBy.create;
cc.catmullRomTo = cc.CatmullRomTo.create;
cc.catmullRomBy = cc.CatmullRomBy.create;
cc.show = cc.Show.create;
cc.hide = cc.Hide.create;
cc.toggleVisibility = cc.ToggleVisibility.create;
cc.removeSelf = cc.RemoveSelf.create;
cc.flipX = cc.FlipX.create;
cc.flipY = cc.FlipY.create;
// cc.place = cc.Place.create;
cc.callFunc = cc.CallFunc.create;
cc.actionInterval = cc.ActionInterval.create;
cc.sequence = cc.Sequence.create;
cc.repeat = cc.Repeat.create;
cc.repeatForever = cc.RepeatForever.create;
cc.spawn = cc.Spawn.create;
cc.rotateTo = cc.RotateTo.create;
cc.rotateBy = cc.RotateBy.create;
//cc.moveBy = cc.MoveBy.create;
//cc.moveTo = cc.MoveTo.create;
cc.skewTo = cc.SkewTo.create;
cc.skewBy = cc.SkewBy.create;
//cc.jumpBy = cc.JumpBy.create;
//cc.jumpTo = cc.JumpTo.create;
cc.bezierBy = cc.BezierBy.create;
cc.bezierTo = cc.BezierTo.create;
cc.scaleTo = cc.ScaleTo.create;
cc.scaleBy = cc.ScaleBy.create;
cc.blink = cc.Blink.create;
cc.fadeTo = cc.FadeTo.create;
cc.fadeIn = cc.FadeIn.create;
cc.fadeOut = cc.FadeOut.create;
cc.tintTo = cc.TintTo.create;
cc.tintBy = cc.TintBy.create;
cc.delayTime = cc.DelayTime.create;
cc.reverseTime = cc.ReverseTime.create;
cc.targetedAction = cc.TargetedAction.create;
cc.Place._create = cc.Place.create;
cc.place = cc.Place.create = function(posOrX, y){
if (undefined === y){
return cc.Place._create(posOrX);
}else{
return cc.Place._create(cc.p(posOrX, y));
}
};
cc.MoveTo._create = cc.MoveTo.create;
cc.moveTo = cc.MoveTo.create = function(duration, posOrX, y){
if (undefined === y){
return cc.MoveTo._create(duration, posOrX);
}else{
return cc.MoveTo._create(duration, cc.p(posOrX, y));
}
};
cc.MoveBy._create = cc.MoveBy.create;
cc.moveBy = cc.MoveBy.create = function(duration, posOrX, y){
if (undefined === y){
return cc.MoveBy._create(duration, posOrX);
}else{
return cc.MoveBy._create(duration, cc.p(posOrX, y));
}
};
cc.JumpTo._create = cc.JumpTo.create;
cc.jumpTo = cc.JumpTo.create = function(duration, position, y, height, jumps){
if (undefined === jumps){
jumps = height;
height = y;
return cc.JumpTo._create(duration, position, height, jumps);
}else{
return cc.JumpTo._create(duration, cc.p(position, y), height, jumps);
}
};
cc.JumpBy._create = cc.JumpBy.create;
cc.jumpBy = cc.JumpBy.create = function(duration, position, y, height, jumps){
if (undefined === jumps){
jumps = height;
height = y;
return cc.JumpBy._create(duration, position, height, jumps);
}else{
return cc.JumpBy._create(duration, cc.p(position, y), height, jumps);
}
};
// Speed functions
cc.Speed.prototype.speed = cc.ActionInterval.prototype.speed = function(speed) {
// if (speed < 0) {
// cc.warn("cc.ActionInterval#speed : Speed must not be negative");
// return;
// }
var action = this, found = false;
while (action.getInnerAction && !found) {
if (action instanceof cc.Speed) {
found = true;
}
else {
action = action.getInnerAction();
}
}
if (found) {
speed = speed * action._getSpeed();
action._setSpeed(speed);
}
else {
this._speed(speed);
}
return this;
};
cc.Speed.prototype.setSpeed = cc.ActionInterval.prototype.setSpeed = function(speed) {
// if (speed < 0) {
// cc.warn("cc.ActionInterval#setSpeed : Speed must not be negative");
// return;
// }
var action = this, found = false;
while (action.getInnerAction && !found) {
if (action instanceof cc.Speed) {
found = true;
}
else {
action = action.getInnerAction();
}
}
if (found) {
action._setSpeed(speed);
}
else {
this._speed(speed);
}
};
cc.Speed.prototype.getSpeed = cc.ActionInterval.prototype.getSpeed = function() {
var action = this, found = false;
while (action.getInnerAction && !found) {
if (action instanceof cc.Speed) {
found = true;
}
else {
action = action.getInnerAction();
}
}
if (found) {
return action._getSpeed();
}
else {
return 1;
}
};
//
// Node API
//
@@ -195,6 +195,220 @@ _p._ctor = function(tmxFile, resourcePath){
}
};
/************************ Actions *************************/
cc.Speed.prototype._ctor = function(action, speed) {
speed !== undefined && this.initWithAction(action, speed);
};
cc.Follow.prototype._ctor = function (followedNode, rect) {
if(followedNode)
rect ? this.initWithTarget(followedNode, rect)
: this.initWithTarget(followedNode);
};
cc.CardinalSplineTo.prototype._ctor = cc.CardinalSplineBy.prototype._ctor = function(duration, points, tension) {
tension !== undefined && this.initWithDuration(duration, points, tension);
};
cc.CatmullRomTo.prototype._ctor = cc.CatmullRomBy.prototype._ctor = function(dt, points) {
points !== undefined && this.initWithDuration(dt, points);
};
var easeCtor = function(action) {
action !== undefined && this.initWithAction(action);
};
cc.ActionEase.prototype._ctor = easeCtor;
cc.EaseExponentialIn.prototype._ctor = easeCtor;
cc.EaseExponentialOut.prototype._ctor = easeCtor;
cc.EaseExponentialInOut.prototype._ctor = easeCtor;
cc.EaseSineIn.prototype._ctor = easeCtor;
cc.EaseSineOut.prototype._ctor = easeCtor;
cc.EaseSineInOut.prototype._ctor = easeCtor;
cc.EaseBounce.prototype._ctor = easeCtor;
cc.EaseBounceIn.prototype._ctor = easeCtor;
cc.EaseBounceOut.prototype._ctor = easeCtor;
cc.EaseBounceInOut.prototype._ctor = easeCtor;
cc.EaseBackIn.prototype._ctor = easeCtor;
cc.EaseBackOut.prototype._ctor = easeCtor;
cc.EaseBackInOut.prototype._ctor = easeCtor;
var easeRateCtor = function(action, rate) {
rate !== undefined && this.initWithAction(action, rate);
};
cc.EaseRateAction.prototype._ctor = easeRateCtor;
cc.EaseIn.prototype._ctor = easeRateCtor;
cc.EaseOut.prototype._ctor = easeRateCtor;
cc.EaseInOut.prototype._ctor = easeRateCtor;
var easeElasticCtor = function(action, period) {
if( action ) {
period !== undefined ? this.initWithAction(action, period)
: this.initWithAction(action);
}
};
cc.EaseElastic.prototype._ctor = easeElasticCtor;
cc.EaseElasticIn.prototype._ctor = easeElasticCtor;
cc.EaseElasticOut.prototype._ctor = easeElasticCtor;
cc.EaseElasticInOut.prototype._ctor = easeElasticCtor;
cc.RemoveSelf.prototype._ctor = function(isNeedCleanUp) {
isNeedCleanUp !== undefined && cc.RemoveSelf.prototype.init.call(this, isNeedCleanUp);
};
cc.FlipX.prototype._ctor = function(flip) {
flip !== undefined && this.initWithFlipX(flip);
};
cc.FlipY.prototype._ctor = function(flip) {
flip !== undefined && this.initWithFlipY(flip);
};
cc.Place.prototype._ctor = function(pos, y) {
if (pos !== undefined) {
if (pos.x !== undefined) {
y = pos.y;
pos = pos.x;
}
this.initWithPosition(cc.p(pos, y));
}
};
cc.CallFunc.prototype._ctor = function(selector, selectorTarget, data) {
if(selector !== undefined){
if(selectorTarget === undefined)
this.initWithFunction(selector);
else this.initWithFunction(selector, selectorTarget, data);
}
};
cc.ActionInterval.prototype._ctor = function(d) {
d !== undefined && this.initWithDuration(d);
};
cc.Sequence.prototype._ctor = function(tempArray) {
var paramArray = (tempArray instanceof Array) ? tempArray : arguments;
var last = paramArray.length - 1;
if ((last >= 0) && (paramArray[last] == null))
cc.log('parameters should not be ending with null in Javascript');
if (last >= 0) {
var prev = paramArray[0];
for (var i = 1; i < last; i++) {
if (paramArray[i]) {
prev = cc.Sequence.create(prev, paramArray[i]);
}
}
this.initWithTwoActions(prev, paramArray[last]);
}
};
cc.Repeat.prototype._ctor = function(action, times) {
times !== undefined && this.initWithAction(action, times);
};
cc.RepeatForever.prototype._ctor = function(action) {
action !== undefined && this.initWithAction(action);
};
cc.Spawn.prototype._ctor = function(tempArray) {
var paramArray = (tempArray instanceof Array) ? tempArray : arguments;
var last = paramArray.length - 1;
if ((last >= 0) && (paramArray[last] == null))
cc.log('parameters should not be ending with null in Javascript');
if (last >= 0) {
var prev = paramArray[0];
for (var i = 1; i < last; i++) {
if (paramArray[i]) {
prev = cc.Spawn.create(prev, paramArray[i]);
}
}
this.initWithTwoActions(prev, paramArray[last]);
}
};
cc.RotateTo.prototype._ctor = cc.RotateBy.prototype._ctor = function(duration, deltaAngleX, deltaAngleY) {
if (deltaAngleX !== undefined) {
if (deltaAngleY !== undefined)
this.initWithDuration(duration, deltaAngleX, deltaAngleY);
else
this.initWithDuration(duration, deltaAngleX, deltaAngleX);
}
};
cc.MoveBy.prototype._ctor = cc.MoveTo.prototype._ctor = function(duration, pos, y) {
if (pos !== undefined) {
if(pos.x === undefined) {
pos = cc.p(pos, y);
}
this.initWithDuration(duration, pos);
}
};
cc.SkewTo.prototype._ctor = cc.SkewBy.prototype._ctor = function(t, sx, sy) {
sy !== undefined && this.initWithDuration(t, sx, sy);
};
cc.JumpBy.prototype._ctor = cc.JumpTo.prototype._ctor = function(duration, position, y, height, jumps) {
if (height !== undefined) {
if (jumps !== undefined) {
position = cc.p(position, y);
}
else {
jumps = height;
height = y;
}
this.initWithDuration(duration, position, height, jumps);
}
};
cc.BezierBy.prototype._ctor = cc.BezierTo.prototype._ctor = function(t, c) {
c !== undefined && this.initWithDuration(t, c);
};
cc.ScaleTo.prototype._ctor = cc.ScaleBy.prototype._ctor = function(duration, sx, sy) {
if (sx !== undefined) {
if (sy !== undefined)
this.initWithDuration(duration, sx, sy);
else this.initWithDuration(duration, sx);
}
};
cc.Blink.prototype._ctor = function(duration, blinks) {
blinks !== undefined && this.initWithDuration(duration, blinks);
};
cc.FadeTo.prototype._ctor = function(duration, opacity) {
opacity !== undefined && this.initWithDuration(duration, opacity);
};
cc.FadeIn.prototype._ctor = function(duration) {
duration !== undefined && this.initWithDuration(duration, 255);
};
cc.FadeOut.prototype._ctor = function(duration) {
duration !== undefined && this.initWithDuration(duration, 0);
};
cc.TintTo.prototype._ctor = cc.TintBy.prototype._ctor = function(duration, red, green, blue) {
blue !== undefined && this.initWithDuration(duration, red, green, blue);
};
cc.DelayTime.prototype._ctor = function(duration) {
duration !== undefined && this.initWithDuration(duration);
};
/*
cc.ReverseTime.prototype._ctor = function(action) {
action && this.initWithAction(action);
};*/
cc.TargetedAction.prototype._ctor = function(target, action) {
action && this.initWithTarget(target, action);
};
/************************ Nodes *************************/
cc.ClippingNode.prototype._ctor = function(stencil) {
@@ -34,6 +34,9 @@ cc.Node.prototype.attr = function(attrs) {
}
};
var _proto = cc.Action.prototype;
cc.defineGetterSetter(_proto, "tag", _proto.getTag, _proto.setTag);
// Overrides
_proto = cc.Label.prototype;
cc.defineGetterSetter(_proto, "size", _proto.getContentSize, _proto.setContentSize);
@@ -106,6 +109,7 @@ cc.defineGetterSetter(_proto, "parent", _proto.getParent, _proto.setParent);
cc.defineGetterSetter(_proto, "visible", _proto.isVisible, _proto.setVisible);
cc.defineGetterSetter(_proto, "running", _proto.isRunning);
cc.defineGetterSetter(_proto, "ignoreAnchor", _proto.isIgnoreAnchorPointForPosition, _proto.ignoreAnchorPointForPosition);
cc.defineGetterSetter(_proto, "actionManager", _proto.getActionManager, _proto.setActionManager);
cc.defineGetterSetter(_proto, "scheduler", _proto.getScheduler, _proto.setScheduler);
cc.defineGetterSetter(_proto, "shaderProgram", _proto.getShaderProgram, _proto.setShaderProgram);
cc.defineGetterSetter(_proto, "glServerState", _proto.getGLServerState, _proto.setGLServerState);
+12 -8
View File
@@ -29,9 +29,9 @@ replace_headers=SimpleAudioEngine.h::audio/include/SimpleAudioEngine.h,CCProtect
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = New.* Sprite SpriteBatchNode SpriteFrame SpriteFrameCache Scene Node Director Layer.* Menu.* Touch PointArray Particle.* Label.* Atlas.* TextureCache.* Texture2D ParallaxNode TileMap.* TMX.* RenderTexture Set SimpleAudioEngine Scheduler DrawNode FileUtils$ GLProgram GLProgramCache Application ClippingNode MotionStreak TextFieldTTF GLViewProtocol GLView Component ComponentContainer SAXParser Event(?!.*(Physics).*).* Device Configuration ProtectedNode GLProgramState Image AsyncTaskPool Properties Material RenderState Pass
classes = New.* Sprite SpriteBatchNode SpriteFrame SpriteFrameCache Scene Node Director Layer.* Menu.* Touch PointArray Particle.* Label.* Atlas.* TextureCache.* Texture2D ParallaxNode TileMap.* TMX.* RenderTexture Set SimpleAudioEngine Scheduler DrawNode FileUtils$ GLProgram GLProgramCache Application ClippingNode MotionStreak TextFieldTTF GLViewProtocol GLView Component ComponentContainer SAXParser Event(?!.*(Physics).*).* Device Configuration ProtectedNode GLProgramState Image AsyncTaskPool Properties Material RenderState Pass ActionManager Action FiniteTimeAction ActionInterval ActionInstant ActionEase Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* FadeIn FadeTo FadeOut Ease.* Scale.* Spawn ReverseTime FlipX FlipY Delay.* Skew.* JumpTo JumpBy Place.* Show.* ToggleVisibility.* RemoveSelf Hide Cardinal.* CatmullRom.* CallFunc CallFuncN Follow.* Bezier.* CardinalSpline.* Speed TargetedAction
classes_need_extend = Node Layer.* Sprite SpriteBatchNode SpriteFrame Menu MenuItem.* Scene DrawNode Component MotionStreak ParticleBatchNode ParticleSystem TextFieldTTF RenderTexture TileMapAtlas TMXLayer TMXTiledMap TMXMapInfo TransitionScene ProgressTimer ParallaxNode Label.* GLProgram
classes_need_extend = Node Layer.* Sprite SpriteBatchNode SpriteFrame Menu MenuItem.* Scene DrawNode Component MotionStreak ParticleBatchNode ParticleSystem TextFieldTTF RenderTexture TileMapAtlas TMXLayer TMXTiledMap TMXMapInfo ProgressTimer ParallaxNode Label.* GLProgram .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Spawn ReverseTime Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* Follow.* Bezier.* Hide CallFunc CallFuncN
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
@@ -46,7 +46,7 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
SpriteBatchNode::[getDescendants],
MotionStreak::[draw update],
DrawNode::[drawPoly$ listenBackToForeground],
Director::[getActionManager setActionManager getAccelerometer getProjection getFrustum getRenderer getConsole getCocos2dThreadId],
Director::[getAccelerometer getProjection getFrustum getRenderer getConsole getCocos2dThreadId],
Layer.*::[didAccelerate keyPressed keyReleased],
Menu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns],
MenuItemToggle::[initWithCallback],
@@ -62,6 +62,8 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
Thread::[*],
Profiler::[*],
ProfilingTimer::[*],
CallFunc::[create initWithFunction (g|s)etTargetCallback],
CallFuncN::[create initWithFunction],
SAXParser::[(?!(init))],
SAXDelegator::[*],
Color3bObject::[*],
@@ -89,6 +91,9 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
TMXMapInfo::[startElement endElement textHandler],
ParticleSystemQuad::[postStep setBatchNode draw setTexture$ setTotalParticles updateQuadWithParticle setupIndices listenBackToForeground initWithTotalParticles particleWithFile node],
LayerMultiplex::[create layerWith.* initWithLayers],
CatmullRom.*::[create actionWithDuration initWithDuration],
Bezier.*::[create actionWithDuration initWithDuration],
CardinalSpline.*::[create actionWithDuration setPoints initWithDuration],
Scheduler::[pause resume ^unschedule$ unscheduleUpdate unscheduleAllForTarget schedule isTargetPaused isScheduled],
TextureCache::[addPVRTCImage],
*::[copyWith.* ^cleanup$ onEnter.* onExit.* ^description$ getObjectType onTouch.* onAcc.* onKey.* onRegisterTouchListener operator.+],
@@ -113,9 +118,6 @@ skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserDat
ClippingNode::[init],
RenderState::[setStateBlock],
ComponentJS::[getScriptObject update],
OrbitCamera::[sphericalRadius],
ShuffleTiles::[shuffle placeTile],
TurnOffTiles::[shuffle],
ParallaxNode::[getParallaxArray setParallaxArray],
TileMapAtlas::[getTGAInfo setTGAInfo],
TMXObject::[getGroupSize]
@@ -146,7 +148,9 @@ rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames ge
rename_classes = ParticleSystemQuad::ParticleSystem,
SimpleAudioEngine::AudioEngine,
SAXParser::PlistParser,
GLProgramCache::ShaderCache
GLProgramCache::ShaderCache,
CallFunc::_CallFunc,
CallFuncN::CallFunc
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
@@ -160,7 +164,7 @@ base_classes_to_skip = Ref Clonable
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes = Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application GLViewProtocol GLView ComponentContainer SAXParser Configuration EventListener AsyncTaskPool
abstract_classes = Director SpriteFrameCache Set SimpleAudioEngine FileUtils Application GLViewProtocol GLView ComponentContainer SAXParser Configuration EventListener AsyncTaskPool Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = yes