int lua_cocos2dx_physics_PhysicsShapePolygon_calculateArea(lua_State* tolua_S) { int argc = 0; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertable(tolua_S,1,"cc.PhysicsShapePolygon",0,&tolua_err)) goto tolua_lerror; #endif argc = lua_gettop(tolua_S) - 1; if (argc == 1) { cocos2d::Point* arg0; int arg1 = 0; do { ok = luaval_to_array_of_Point(tolua_S, 2, &arg0, &arg1); if (nullptr == arg0){ LUA_PRECONDITION( arg0, "Invalid Native Object"); }} while (0); if(!ok) { CC_SAFE_FREE(arg0); return 0; } double ret = cocos2d::PhysicsShapePolygon::calculateArea(arg0, arg1); CC_SAFE_FREE(arg0); tolua_pushnumber(tolua_S,(lua_Number)ret); return 1; } CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "calculateArea",argc, 2); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsShapePolygon_calculateArea'.",&tolua_err); #endif return 0; }
bool getVec2Array(lua_State* tolua_S,int lo,const char *funcName,std::vector<Vec2> &output) { output.clear(); Vec2 *array; int count; bool ok = false; do { ok = luaval_to_array_of_vec2(tolua_S, lo, &array, &count, funcName); if (nullptr == array) LUA_PRECONDITION( array, "Invalid Native Object"); } while (0); if(!ok) { CC_SAFE_DELETE_ARRAY(array); return false; } for (int i=0; i < count; ++i) output.push_back(array[i]); return true; }
int lua_cocos2dx_physics_PhysicsShapePolygon_create(lua_State* tolua_S) { int argc = 0; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertable(tolua_S,1,"cc.PhysicsShapePolygon",0,&tolua_err)) goto tolua_lerror; #endif argc = lua_gettop(tolua_S) - 1; if (argc == 1) { cocos2d::Point* arg0; int arg1 = 0; do { ok = luaval_to_array_of_Point(tolua_S, 2, &arg0, &arg1); if (nullptr == arg0){ LUA_PRECONDITION( arg0, "Invalid Native Object"); }} while (0); if(!ok) { CC_SAFE_FREE(arg0); return 0; } cocos2d::PhysicsShapePolygon* ret = cocos2d::PhysicsShapePolygon::create(arg0, arg1); CC_SAFE_FREE(arg0); object_to_luaval<cocos2d::PhysicsShapePolygon>(tolua_S, "cc.PhysicsShapePolygon",(cocos2d::PhysicsShapePolygon*)ret); return 1; } if (argc == 2) { cocos2d::Point* arg0; int arg1 = 0; cocos2d::PhysicsMaterial arg2; do { ok = luaval_to_array_of_Point(tolua_S, 2, &arg0, &arg1); if (nullptr == arg0){ LUA_PRECONDITION( arg0, "Invalid Native Object"); }} while (0); ok &= luaval_to_physics_material(tolua_S, 3, &arg2); if(!ok) { CC_SAFE_FREE(arg0); return 0; } cocos2d::PhysicsShapePolygon* ret = cocos2d::PhysicsShapePolygon::create(arg0, arg1, arg2); CC_SAFE_FREE(arg0); object_to_luaval<cocos2d::PhysicsShapePolygon>(tolua_S, "cc.PhysicsShapePolygon",(cocos2d::PhysicsShapePolygon*)ret); return 1; } if (argc == 3) { cocos2d::Point* arg0; int arg1 = 0; cocos2d::PhysicsMaterial arg2; cocos2d::Point arg3; do { ok = luaval_to_array_of_Point(tolua_S, 2, &arg0, &arg1); if (nullptr == arg0){ LUA_PRECONDITION( arg0, "Invalid Native Object"); }} while (0); ok &= luaval_to_physics_material(tolua_S, 3, &arg2); ok &= luaval_to_point(tolua_S, 4, &arg3); if(!ok) { CC_SAFE_FREE(arg0); return 0; } cocos2d::PhysicsShapePolygon* ret = cocos2d::PhysicsShapePolygon::create(arg0, arg1, arg2, arg3); CC_SAFE_FREE(arg0); object_to_luaval<cocos2d::PhysicsShapePolygon>(tolua_S, "cc.PhysicsShapePolygon",(cocos2d::PhysicsShapePolygon*)ret); return 1; } CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "create",argc, 2); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsShapePolygon_create'.",&tolua_err); #endif return 0; }
int lua_cocos2dx_physics_PhysicsBody_createEdgeChain(lua_State* tolua_S) { int argc = 0; bool ok = true; #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif #if COCOS2D_DEBUG >= 1 if (!tolua_isusertable(tolua_S,1,"cc.PhysicsBody",0,&tolua_err)) goto tolua_lerror; #endif argc = lua_gettop(tolua_S) - 1; if (argc == 1) { cocos2d::Point* arg0; int arg1; do { ok = luaval_to_array_of_Point(tolua_S, 2, &arg0, &arg1); if (nullptr == arg0){ LUA_PRECONDITION( arg0, "Invalid Native Object"); }} while (0); if(!ok) { CC_SAFE_FREE(arg0); return 0; } cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createEdgeChain(arg0, arg1); CC_SAFE_FREE(arg0); do { if (nullptr != ret) { int ID = ret->_ID; int* luaID = &ret->_luaID; toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody"); } else { lua_pushnil(tolua_S); } } while (0); return 1; } if (argc == 2) { cocos2d::Point* arg0; int arg1; cocos2d::PhysicsMaterial arg2; do { ok = luaval_to_array_of_Point(tolua_S, 2, &arg0, &arg1); if (nullptr == arg0){ LUA_PRECONDITION( arg0, "Invalid Native Object"); }} while (0); ok &= luaval_to_physics_material(tolua_S, 3, &arg2); if(!ok) { CC_SAFE_FREE(arg0); return 0; } cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createEdgeChain(arg0, arg1, arg2); CC_SAFE_FREE(arg0); do { if (nullptr != ret) { int ID = ret->_ID; int* luaID = &ret->_luaID; toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody"); } else { lua_pushnil(tolua_S); } } while (0); return 1; } if (argc == 3) { cocos2d::Point* arg0; int arg1; cocos2d::PhysicsMaterial arg2; double arg3; do { ok = luaval_to_array_of_Point(tolua_S, 2, &arg0, &arg1); if (nullptr == arg0){ LUA_PRECONDITION( arg0, "Invalid Native Object"); }} while (0); ok &= luaval_to_physics_material(tolua_S, 3, &arg2); ok &= luaval_to_number(tolua_S, 4,&arg3); if(!ok) { CC_SAFE_FREE(arg0); return 0; } cocos2d::PhysicsBody* ret = cocos2d::PhysicsBody::createEdgeChain(arg0, arg1, arg2, arg3); CC_SAFE_FREE(arg0); do { if (nullptr != ret) { int ID = ret->_ID; int* luaID = &ret->_luaID; toluafix_pushusertype_ccobject(tolua_S,ID, luaID, (void*)ret, "cc.PhysicsBody"); } else { lua_pushnil(tolua_S); } } while (0); return 1; } CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "createEdgeChain",argc, 2); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsBody_createEdgeChain'.",&tolua_err); #endif return 0; }