From af6b6bb7b99de503117bece98fe6ef54d606bfd7 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Tue, 9 Sep 2014 02:32:49 +0000 Subject: [PATCH] [AUTO]: updating luabinding automatically --- .../lua-bindings/auto/api/PhysicsWorld.lua | 16 +++- .../auto/lua_cocos2dx_physics_auto.cpp | 92 +++++++++++++++++++ .../auto/lua_cocos2dx_physics_auto.hpp | 2 + 3 files changed, 109 insertions(+), 1 deletion(-) diff --git a/cocos/scripting/lua-bindings/auto/api/PhysicsWorld.lua b/cocos/scripting/lua-bindings/auto/api/PhysicsWorld.lua index 7a15ac9d59..fbf878bc96 100644 --- a/cocos/scripting/lua-bindings/auto/api/PhysicsWorld.lua +++ b/cocos/scripting/lua-bindings/auto/api/PhysicsWorld.lua @@ -21,10 +21,18 @@ -- @param self -- @return int#int ret (return value: int) +-------------------------------- +-- set the number of substeps in an update of the physics world.
+-- One physics update will be divided into several substeps to increase its accuracy.
+-- default value is 1 +-- @function [parent=#PhysicsWorld] setSubsteps +-- @param self +-- @param #int steps + -------------------------------- -- To control the step of physics, if you want control it by yourself( fixed-timestep for example ), you can set this to false and call step by yourself.
-- Defaut value is true.
--- Note: if you set auto step to false, setSpeed and setUpdateRate won't work, you need to control the time step by yourself. +-- Note: if you set auto step to false, setSpeed setSubsteps and setUpdateRate won't work, you need to control the time step by yourself. -- @function [parent=#PhysicsWorld] setAutoStep -- @param self -- @param #bool autoStep @@ -95,6 +103,12 @@ -- @param self -- @param #int rate +-------------------------------- +-- get the number of substeps +-- @function [parent=#PhysicsWorld] getSubsteps +-- @param self +-- @return int#int ret (return value: int) + -------------------------------- -- get the speed of physics world -- @function [parent=#PhysicsWorld] getSpeed diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp index ae36e585ea..4327b294ab 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp @@ -10183,6 +10183,52 @@ int lua_cocos2dx_physics_PhysicsWorld_getDebugDrawMask(lua_State* tolua_S) return 0; } +int lua_cocos2dx_physics_PhysicsWorld_setSubsteps(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::PhysicsWorld* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.PhysicsWorld",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::PhysicsWorld*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics_PhysicsWorld_setSubsteps'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + int arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "cc.PhysicsWorld:setSubsteps"); + if(!ok) + return 0; + cobj->setSubsteps(arg0); + return 0; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsWorld:setSubsteps",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsWorld_setSubsteps'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_physics_PhysicsWorld_setAutoStep(lua_State* tolua_S) { int argc = 0; @@ -10713,6 +10759,50 @@ int lua_cocos2dx_physics_PhysicsWorld_setUpdateRate(lua_State* tolua_S) return 0; } +int lua_cocos2dx_physics_PhysicsWorld_getSubsteps(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::PhysicsWorld* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.PhysicsWorld",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::PhysicsWorld*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics_PhysicsWorld_getSubsteps'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + int ret = cobj->getSubsteps(); + tolua_pushnumber(tolua_S,(lua_Number)ret); + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsWorld:getSubsteps",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsWorld_getSubsteps'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_physics_PhysicsWorld_getSpeed(lua_State* tolua_S) { int argc = 0; @@ -10999,6 +11089,7 @@ int lua_register_cocos2dx_physics_PhysicsWorld(lua_State* tolua_S) tolua_function(tolua_S,"setGravity",lua_cocos2dx_physics_PhysicsWorld_setGravity); tolua_function(tolua_S,"getAllBodies",lua_cocos2dx_physics_PhysicsWorld_getAllBodies); tolua_function(tolua_S,"getDebugDrawMask",lua_cocos2dx_physics_PhysicsWorld_getDebugDrawMask); + tolua_function(tolua_S,"setSubsteps",lua_cocos2dx_physics_PhysicsWorld_setSubsteps); tolua_function(tolua_S,"setAutoStep",lua_cocos2dx_physics_PhysicsWorld_setAutoStep); tolua_function(tolua_S,"addJoint",lua_cocos2dx_physics_PhysicsWorld_addJoint); tolua_function(tolua_S,"removeAllJoints",lua_cocos2dx_physics_PhysicsWorld_removeAllJoints); @@ -11010,6 +11101,7 @@ int lua_register_cocos2dx_physics_PhysicsWorld(lua_State* tolua_S) tolua_function(tolua_S,"setDebugDrawMask",lua_cocos2dx_physics_PhysicsWorld_setDebugDrawMask); tolua_function(tolua_S,"getGravity",lua_cocos2dx_physics_PhysicsWorld_getGravity); tolua_function(tolua_S,"setUpdateRate",lua_cocos2dx_physics_PhysicsWorld_setUpdateRate); + tolua_function(tolua_S,"getSubsteps",lua_cocos2dx_physics_PhysicsWorld_getSubsteps); tolua_function(tolua_S,"getSpeed",lua_cocos2dx_physics_PhysicsWorld_getSpeed); tolua_function(tolua_S,"getUpdateRate",lua_cocos2dx_physics_PhysicsWorld_getUpdateRate); tolua_function(tolua_S,"removeAllBodies",lua_cocos2dx_physics_PhysicsWorld_removeAllBodies); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp index 42884debc5..4a61023ad2 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp @@ -263,6 +263,8 @@ int register_all_cocos2dx_physics(lua_State* tolua_S); + +