1.c++底层修改
/** * seconds had elapsed since the actions startd to run. */ void setElapsed(float elapsed,bool firstTick);
CCActionInterval.cpp
void ActionInterval::setElapsed(float elapsed,bool firstTick) { _elapsed = elapsed; _firstTick = firstTick; }
2.js-bindings
项目/frameworks/cocos2d-x/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp
bool js_cocos2dx_ActionInterval_setElapsed(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::ActionInterval* cobj = (cocos2d::ActionInterval *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj,cx,false,"js_cocos2dx_ActionInterval_setElapsed : Invalid Native Object"); if (argc == 2) { double arg0 = 0; bool arg1; ok &= JS::ToNumber( cx,args.get(0),&arg0) && !std::isnan(arg0); arg1 = JS::ToBoolean(args.get(1)); JSB_PRECONDITION2(ok,"js_cocos2dx_ActionInterval_setElapsed : Error processing arguments"); cobj->setElapsed(arg0,arg1); args.rval().setUndefined(); return true; } JS_ReportError(cx,"js_cocos2dx_ActionInterval_setElapsed : wrong number of arguments: %d,was expecting %d",argc,2); return false; }
static JSFunctionSpec funcs[] = { JS_FN("getAmplitudeRate",js_cocos2dx_ActionInterval_getAmplitudeRate,0,JSPROP_PERMANENT | JSPROP_ENUMERATE),JS_FN("setElapsed",js_cocos2dx_ActionInterval_setElapsed,2,JS_FN("initWithDuration",js_cocos2dx_ActionInterval_initWithDuration,1,JS_FN("setAmplitudeRate",js_cocos2dx_ActionInterval_setAmplitudeRate,JS_FN("getElapsed",js_cocos2dx_ActionInterval_getElapsed,JS_FS_END };
项目/frameworks/cocos2d-x/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp
bool js_cocos2dx_ActionInterval_setElapsed(JSContext *cx,jsval *vp);
3.js
项目/frameworks/cocos2d-html5/cocos2d/actions/CCActionInterval.js
setElapsed:function (elapsed ,firstTick) { this._elapsed = elapsed; this._firstTick = firstTick; },