mirror of https://github.com/axmolengine/axmol.git
fix polygon api typo
This commit is contained in:
parent
86ea337efd
commit
589d7e47bf
|
@ -2430,13 +2430,13 @@ bool js_cocos2dx_CCNode_setColor(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
cobj->setColor(arg0);
|
cobj->setColor(arg0);
|
||||||
|
|
||||||
// int32_t alpha;
|
// 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) {
|
// if (ok) {
|
||||||
// cobj->setOpacity(alpha);
|
// cobj->setOpacity(alpha);
|
||||||
// }
|
// }
|
||||||
args.rval().setUndefined();
|
args.rval().setUndefined();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_ReportError(cx, "js_cocos2dx_Node_setColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
JS_ReportError(cx, "js_cocos2dx_Node_setColor : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||||
return false;
|
return false;
|
||||||
|
@ -5353,81 +5353,81 @@ bool js_cocos2dx_Scene_getPhysics3DWorld(JSContext *cx, uint32_t argc, jsval *vp
|
||||||
#if CC_USE_NAVMESH
|
#if CC_USE_NAVMESH
|
||||||
bool js_cocos2dx_Scene_setNavMeshDebugCamera(JSContext *cx, uint32_t argc, jsval *vp)
|
bool js_cocos2dx_Scene_setNavMeshDebugCamera(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
{
|
{
|
||||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||||
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
||||||
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Invalid Native Object");
|
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Invalid Native Object");
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
cocos2d::Camera* arg0;
|
cocos2d::Camera* arg0;
|
||||||
do {
|
do {
|
||||||
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
||||||
if (!args.get(0).isObject()) { ok = false; break; }
|
if (!args.get(0).isObject()) { ok = false; break; }
|
||||||
js_proxy_t *jsProxy;
|
js_proxy_t *jsProxy;
|
||||||
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
||||||
jsProxy = jsb_get_js_proxy(tmpObj);
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
||||||
arg0 = (cocos2d::Camera*)(jsProxy ? jsProxy->ptr : NULL);
|
arg0 = (cocos2d::Camera*)(jsProxy ? jsProxy->ptr : NULL);
|
||||||
JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object");
|
JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object");
|
||||||
} while (0);
|
} while (0);
|
||||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Error processing arguments");
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMeshDebugCamera : Error processing arguments");
|
||||||
cobj->setNavMeshDebugCamera(arg0);
|
cobj->setNavMeshDebugCamera(arg0);
|
||||||
args.rval().setUndefined();
|
args.rval().setUndefined();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_ReportError(cx, "js_cocos2dx_Scene_setNavMeshDebugCamera : wrong number of arguments: %d, was expecting %d", argc, 1);
|
JS_ReportError(cx, "js_cocos2dx_Scene_setNavMeshDebugCamera : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool js_cocos2dx_Scene_setNavMesh(JSContext *cx, uint32_t argc, jsval *vp)
|
bool js_cocos2dx_Scene_setNavMesh(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
{
|
{
|
||||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||||
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
||||||
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMesh : Invalid Native Object");
|
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_setNavMesh : Invalid Native Object");
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
cocos2d::NavMesh* arg0;
|
cocos2d::NavMesh* arg0;
|
||||||
do {
|
do {
|
||||||
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
if (args.get(0).isNull()) { arg0 = nullptr; break; }
|
||||||
if (!args.get(0).isObject()) { ok = false; break; }
|
if (!args.get(0).isObject()) { ok = false; break; }
|
||||||
js_proxy_t *jsProxy;
|
js_proxy_t *jsProxy;
|
||||||
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull());
|
||||||
jsProxy = jsb_get_js_proxy(tmpObj);
|
jsProxy = jsb_get_js_proxy(tmpObj);
|
||||||
arg0 = (cocos2d::NavMesh*)(jsProxy ? jsProxy->ptr : NULL);
|
arg0 = (cocos2d::NavMesh*)(jsProxy ? jsProxy->ptr : NULL);
|
||||||
JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object");
|
JSB_PRECONDITION2(arg0, cx, false, "Invalid Native Object");
|
||||||
} while (0);
|
} while (0);
|
||||||
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMesh : Error processing arguments");
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Scene_setNavMesh : Error processing arguments");
|
||||||
cobj->setNavMesh(arg0);
|
cobj->setNavMesh(arg0);
|
||||||
args.rval().setUndefined();
|
args.rval().setUndefined();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_ReportError(cx, "js_cocos2dx_Scene_setNavMesh : wrong number of arguments: %d, was expecting %d", argc, 1);
|
JS_ReportError(cx, "js_cocos2dx_Scene_setNavMesh : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool js_cocos2dx_Scene_getNavMesh(JSContext *cx, uint32_t argc, jsval *vp)
|
bool js_cocos2dx_Scene_getNavMesh(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
{
|
{
|
||||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||||
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
cocos2d::Scene* cobj = (cocos2d::Scene *)(proxy ? proxy->ptr : NULL);
|
||||||
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_getNavMesh : Invalid Native Object");
|
JSB_PRECONDITION2(cobj, cx, false, "js_cocos2dx_Scene_getNavMesh : Invalid Native Object");
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
cocos2d::NavMesh* ret = cobj->getNavMesh();
|
cocos2d::NavMesh* ret = cobj->getNavMesh();
|
||||||
jsval jsret = JSVAL_NULL;
|
jsval jsret = JSVAL_NULL;
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
js_type_class_t *typeClass = js_get_type_from_native<cocos2d::NavMesh>(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"));
|
jsret = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(cx, ret, typeClass, "cocos2d::NavMesh"));
|
||||||
}
|
}
|
||||||
args.rval().set(jsret);
|
args.rval().set(jsret);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_ReportError(cx, "js_cocos2dx_Scene_getNavMesh : wrong number of arguments: %d, was expecting %d", argc, 0);
|
JS_ReportError(cx, "js_cocos2dx_Scene_getNavMesh : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif //CC_USE_NAVMESH
|
#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);
|
JS_ReportError(cx, "js_cocos2dx_PolygonInfo_getArea : wrong number of arguments: %d, was expecting %d", argc, 0);
|
||||||
return false;
|
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::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||||
cocos2d::PolygonInfo* cobj = (cocos2d::PolygonInfo *)(proxy ? proxy->ptr : NULL);
|
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)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
const unsigned int ret = cobj->getTrianglesCount();
|
const unsigned int ret = cobj->getTrianglesCount();
|
||||||
|
@ -5469,7 +5469,7 @@ bool js_cocos2dx_PolygonInfo_getTriaglesCount(JSContext *cx, uint32_t argc, jsva
|
||||||
return true;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
bool js_cocos2dx_PolygonInfo_getVertCount(JSContext *cx, uint32_t argc, jsval *vp)
|
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[] =
|
static JSFunctionSpec funcs[] =
|
||||||
{
|
{
|
||||||
JS_FN("getArea", js_cocos2dx_PolygonInfo_getArea, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
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_FN("getVertCount", js_cocos2dx_PolygonInfo_getVertCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FS_END
|
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
|
#endif //CC_ENABLE_BULLET_INTEGRATION && CC_USE_3D_PHYSICS
|
||||||
|
|
||||||
#if CC_USE_NAVMESH
|
#if CC_USE_NAVMESH
|
||||||
tmpObj.set(jsb_cocos2d_Scene_prototype);
|
tmpObj.set(jsb_cocos2d_Scene_prototype);
|
||||||
JS_DefineFunction(cx, tmpObj, "getNavMesh", js_cocos2dx_Scene_getNavMesh, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
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, "setNavMeshDebugCamera", js_cocos2dx_Scene_setNavMeshDebugCamera, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||||
JS_DefineFunction(cx, tmpObj, "setNavMesh", js_cocos2dx_Scene_setNavMesh, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
JS_DefineFunction(cx, tmpObj, "setNavMesh", js_cocos2dx_Scene_setNavMesh, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
|
||||||
#endif //CC_USE_NAVMESH
|
#endif //CC_USE_NAVMESH
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,7 +429,7 @@ var SpritePolygonPerformanceTestDynamic = SpritePolygonPerformance.extend({
|
||||||
},
|
},
|
||||||
initIncrementStats: function () {
|
initIncrementStats: function () {
|
||||||
this._incVert = this._polygons.getVertCount();
|
this._incVert = this._polygons.getVertCount();
|
||||||
this._incTri = this._polygons.getTriaglesCount();
|
this._incTri = this._polygons.getTrianglesCount();
|
||||||
this._incPix = this._polygons.getArea();
|
this._incPix = this._polygons.getArea();
|
||||||
},
|
},
|
||||||
makeSprite: function () {
|
makeSprite: function () {
|
||||||
|
|
|
@ -690,7 +690,7 @@ end
|
||||||
|
|
||||||
function SpritePolygonPerformanceTestDynamic:initIncrementStats()
|
function SpritePolygonPerformanceTestDynamic:initIncrementStats()
|
||||||
self._incVert = self._info:getVertCount()
|
self._incVert = self._info:getVertCount()
|
||||||
self._incTri = self._info:getTriaglesCount()
|
self._incTri = self._info:getTrianglesCount()
|
||||||
self._incPix = self._info:getArea()
|
self._incPix = self._info:getArea()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue