mirror of https://github.com/axmolengine/axmol.git
[AUTO]: updating luabinding automatically
This commit is contained in:
parent
8c595e9d24
commit
af6b6bb7b9
|
@ -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.<br>
|
||||
-- One physics update will be divided into several substeps to increase its accuracy.<br>
|
||||
-- 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.<br>
|
||||
-- Defaut value is true.<br>
|
||||
-- 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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -263,6 +263,8 @@ int register_all_cocos2dx_physics(lua_State* tolua_S);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue