Merge pull request #15274 from zilongshanren/fixJsBindings-deprecated

fix polygon api typo
This commit is contained in:
zilongshanren 2016-03-18 13:44:40 +08:00
commit 6ce5ee24b4
3 changed files with 76 additions and 75 deletions

View File

@ -2430,13 +2430,13 @@ bool js_cocos2dx_CCNode_setColor(JSContext *cx, uint32_t argc, jsval *vp)
cobj->setColor(arg0);
// int32_t alpha;
// ok &= jsval_cccolor_to_opacity(cx, args.get(0), &alpha);
// ok &= jsval_cccolor_to_opacity(cx, args.get(0), &alpha);
// if (ok) {
// cobj->setOpacity(alpha);
// }
args.rval().setUndefined();
return true;
}
return true;
}
JS_ReportError(cx, "js_cocos2dx_Node_setColor : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
@ -5353,81 +5353,81 @@ bool js_cocos2dx_Scene_getPhysics3DWorld(JSContext *cx, uint32_t argc, jsval *vp
#if CC_USE_NAVMESH
bool js_cocos2dx_Scene_setNavMeshDebugCamera(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::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Invalid Native Object");
if (argc == 1) {
cocos2d::Camera* arg0;
do {
if (args.get(0).isNull()) { arg0 = nullptr; break; }
if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Camera*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Error processing arguments");
cobj->setNavMeshDebugCamera(arg0);
args.rval().setUndefined();
return true;
}
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::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Invalid Native Object");
if (argc == 1) {
cocos2d::Camera* arg0;
do {
if (args.get(0).isNull()) { arg0 = nullptr; break; }
if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::Camera*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Error processing arguments");
cobj->setNavMeshDebugCamera(arg0);
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scene_setNavMeshDebugCamera : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
JS_ReportError(cx, "js_cocos2dx_Scene_setNavMeshDebugCamera : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Scene_setNavMesh(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::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMesh : Invalid Native Object");
if (argc == 1) {
cocos2d::NavMesh* arg0;
do {
if (args.get(0).isNull()) { arg0 = nullptr; break; }
if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::NavMesh*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMesh : Error processing arguments");
cobj->setNavMesh(arg0);
args.rval().setUndefined();
return true;
}
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::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMesh : Invalid Native Object");
if (argc == 1) {
cocos2d::NavMesh* arg0;
do {
if (args.get(0).isNull()) { arg0 = nullptr; break; }
if (!args.get(0).isObject()) { ok = false; break; }
js_proxy_t *jsProxy;
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
jsProxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::NavMesh*)(jsProxy ? jsProxy->ptr : NULL);
JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMesh : Error processing arguments");
cobj->setNavMesh(arg0);
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scene_setNavMesh : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
JS_ReportError(cx, "js_cocos2dx_Scene_setNavMesh : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_Scene_getNavMesh(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::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_getNavMesh : Invalid Native Object");
if (argc == 0) {
cocos2d::NavMesh* ret = cobj->getNavMesh();
jsval jsret = JSVAL_NULL;
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_getNavMesh : Invalid Native Object");
if (argc == 0) {
cocos2d::NavMesh* ret = cobj->getNavMesh();
jsval jsret = JSVAL_NULL;
if (ret)
{
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::NavMesh>(ret);
jsret = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(cx, ret, typeClass, "cocos2d::NavMesh"));
}
args.rval().set(jsret);
return true;
}
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_Scene_getNavMesh : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
JS_ReportError(cx, "js_cocos2dx_Scene_getNavMesh : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
#endif //CC_USE_NAVMESH
@ -5453,13 +5453,13 @@ bool js_cocos2dx_PolygonInfo_getArea(JSContext *cx, uint32_t argc, jsval *vp)
JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getArea : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_PolygonInfo_getTriaglesCount(JSContext *cx, uint32_t argc, jsval *vp)
bool js_cocos2dx_PolygonInfo_getTrianglesCount(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::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PolygonInfo_getTriaglesCount : Invalid Native Object");
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_PolygonInfo_getTrianglesCount : Invalid Native Object");
if (argc == 0)
{
const unsigned int ret = cobj->getTrianglesCount();
@ -5469,7 +5469,7 @@ bool js_cocos2dx_PolygonInfo_getTriaglesCount(JSContext *cx, uint32_t argc, jsva
return true;
}
JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getTriaglesCount : wrong number of arguments: %d, was expecting %d", argc, 0);
JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getTrianglesCount : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_PolygonInfo_getVertCount(JSContext *cx, uint32_t argc, jsval *vp)
@ -5630,7 +5630,8 @@ void js_register_cocos2dx_PolygonInfo(JSContext *cx, JS::HandleObject global)
static JSFunctionSpec funcs[] =
{
JS_FN("getArea", js_cocos2dx_PolygonInfo_getArea, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTriaglesCount", js_cocos2dx_PolygonInfo_getTriaglesCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTrianglesCount", js_cocos2dx_PolygonInfo_getTrianglesCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTriaglesCount", js_cocos2dx_PolygonInfo_getTrianglesCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getVertCount", js_cocos2dx_PolygonInfo_getVertCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
@ -6237,9 +6238,9 @@ void register_cocos2dx_js_core(JSContext* cx, JS::HandleObject global)
#endif //CC_ENABLE_BULLET_INTEGRATION && CC_USE_3D_PHYSICS
#if CC_USE_NAVMESH
tmpObj.set(jsb_cocos2d_Scene_prototype);
JS_DefineFunction(cx, tmpObj, "getNavMesh", js_cocos2dx_Scene_getNavMesh, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "setNavMeshDebugCamera", js_cocos2dx_Scene_setNavMeshDebugCamera, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "setNavMesh", js_cocos2dx_Scene_setNavMesh, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
tmpObj.set(jsb_cocos2d_Scene_prototype);
JS_DefineFunction(cx, tmpObj, "getNavMesh", js_cocos2dx_Scene_getNavMesh, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "setNavMeshDebugCamera", js_cocos2dx_Scene_setNavMeshDebugCamera, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "setNavMesh", js_cocos2dx_Scene_setNavMesh, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
#endif //CC_USE_NAVMESH
}

View File

@ -429,7 +429,7 @@ var SpritePolygonPerformanceTestDynamic = SpritePolygonPerformance.extend({
},
initIncrementStats: function () {
this._incVert = this._polygons.getVertCount();
this._incTri = this._polygons.getTriaglesCount();
this._incTri = this._polygons.getTrianglesCount();
this._incPix = this._polygons.getArea();
},
makeSprite: function () {

View File

@ -690,7 +690,7 @@ end
function SpritePolygonPerformanceTestDynamic:initIncrementStats()
self._incVert = self._info:getVertCount()
self._incTri = self._info:getTriaglesCount()
self._incTri = self._info:getTrianglesCount()
self._incPix = self._info:getArea()
end
@ -746,4 +746,4 @@ function SpritePolygonTest()
scene:addChild(CreateBackMenuItem())
return scene
end
end