Imported some of the dynamiccore branch from love-experiments:

- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array.

- luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array.

Also removed most of the header declarations for wrapper functions.
This commit is contained in:
Alex Szpakowski
2015-11-29 20:38:12 -04:00
parent 77998c707d
commit 2c4e713114
124 changed files with 251 additions and 1300 deletions
+2 -2
View File
@@ -585,7 +585,7 @@ int w_Body_getUserData(lua_State *L)
return t->getUserData(L);
}
static const luaL_Reg functions[] =
static const luaL_Reg w_Body_functions[] =
{
{ "getX", w_Body_getX },
{ "getY", w_Body_getY },
@@ -650,7 +650,7 @@ static const luaL_Reg functions[] =
extern "C" int luaopen_body(lua_State *L)
{
return luax_register_type(L, PHYSICS_BODY_ID, functions);
return luax_register_type(L, PHYSICS_BODY_ID, "Body", w_Body_functions, nullptr);
}
} // box2d
-58
View File
@@ -33,64 +33,6 @@ namespace box2d
{
Body *luax_checkbody(lua_State *L, int idx);
int w_Body_getX(lua_State *L);
int w_Body_getY(lua_State *L);
int w_Body_getAngle(lua_State *L);
int w_Body_getPosition(lua_State *L);
int w_Body_getLinearVelocity(lua_State *L);
int w_Body_getWorldCenter(lua_State *L);
int w_Body_getLocalCenter(lua_State *L);
int w_Body_getAngularVelocity(lua_State *L);
int w_Body_getMass(lua_State *L);
int w_Body_getInertia(lua_State *L);
int w_Body_getMassData(lua_State *L);
int w_Body_getAngularDamping(lua_State *L);
int w_Body_getLinearDamping(lua_State *L);
int w_Body_getGravityScale(lua_State *L);
int w_Body_getType(lua_State *L);
int w_Body_applyLinearImpulse(lua_State *L);
int w_Body_applyAngularImpulse(lua_State *L);
int w_Body_applyTorque(lua_State *L);
int w_Body_applyForce(lua_State *L);
int w_Body_setX(lua_State *L);
int w_Body_setY(lua_State *L);
int w_Body_setLinearVelocity(lua_State *L);
int w_Body_setAngle(lua_State *L);
int w_Body_setAngularVelocity(lua_State *L);
int w_Body_setPosition(lua_State *L);
int w_Body_resetMassData(lua_State *L);
int w_Body_setMassData(lua_State *L);
int w_Body_setMass(lua_State *L);
int w_Body_setInertia(lua_State *L);
int w_Body_setAngularDamping(lua_State *L);
int w_Body_setLinearDamping(lua_State *L);
int w_Body_setGravityScale(lua_State *L);
int w_Body_setType(lua_State *L);
int w_Body_getWorldPoint(lua_State *L);
int w_Body_getWorldVector(lua_State *L);
int w_Body_getWorldPoints(lua_State *L);
int w_Body_getLocalPoint(lua_State *L);
int w_Body_getLocalVector(lua_State *L);
int w_Body_getLinearVelocityFromWorldPoint(lua_State *L);
int w_Body_getLinearVelocityFromLocalPoint(lua_State *L);
int w_Body_isBullet(lua_State *L);
int w_Body_setBullet(lua_State *L);
int w_Body_isActive(lua_State *L);
int w_Body_isAwake(lua_State *L);
int w_Body_setSleepingAllowed(lua_State *L);
int w_Body_isSleepingAllowed(lua_State *L);
int w_Body_setActive(lua_State *L);
int w_Body_setAwake(lua_State *L);
int w_Body_setFixedRotation(lua_State *L);
int w_Body_isFixedRotation(lua_State *L);
int w_Body_getWorld(lua_State *L);
int w_Body_getFixtureList(lua_State *L);
int w_Body_getJointList(lua_State *L);
int w_Body_getContactList(lua_State *L);
int w_Body_destroy(lua_State *L);
int w_Body_isDestroyed(lua_State *L);
int w_Body_setUserData(lua_State *L);
int w_Body_getUserData(lua_State *L);
extern "C" int luaopen_body(lua_State *L);
} // box2d
+2 -10
View File
@@ -98,7 +98,7 @@ int w_ChainShape_getPoints(lua_State *L)
return count*2;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_ChainShape_functions[] =
{
{ "setNextVertex", w_ChainShape_setNextVertex },
{ "setPreviousVertex", w_ChainShape_setPreviousVertex },
@@ -106,20 +106,12 @@ static const luaL_Reg functions[] =
{ "getVertexCount", w_ChainShape_getVertexCount },
{ "getPoint", w_ChainShape_getPoint },
{ "getPoints", w_ChainShape_getPoints },
// From Shape.
{ "getType", w_Shape_getType },
{ "getRadius", w_Shape_getRadius },
{ "getChildCount", w_Shape_getChildCount },
{ "testPoint", w_Shape_testPoint },
{ "rayCast", w_Shape_rayCast },
{ "computeAABB", w_Shape_computeAABB },
{ "computeMass", w_Shape_computeMass },
{ 0, 0 }
};
extern "C" int luaopen_chainshape(lua_State *L)
{
return luax_register_type(L, PHYSICS_CHAIN_SHAPE_ID, functions);
return luax_register_type(L, PHYSICS_CHAIN_SHAPE_ID, "ChainShape", w_Shape_functions, w_ChainShape_functions, nullptr);
}
} // box2d
@@ -34,14 +34,6 @@ namespace box2d
{
ChainShape *luax_checkchainshape(lua_State *L, int idx);
int w_ChainShape_setNextVertex(lua_State *L);
int w_ChainShape_setPreviousVertex(lua_State *L);
int w_ChainShape_getChildEdge(lua_State *L);
int w_ChainShape_getVertexCount(lua_State *L);
int w_ChainShape_getPoint(lua_State *L);
int w_ChainShape_getPoints(lua_State *L);
extern "C" int luaopen_chainshape(lua_State *L);
} // box2d
+2 -10
View File
@@ -64,26 +64,18 @@ int w_CircleShape_setPoint(lua_State *L)
return 0;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_CircleShape_functions[] =
{
{ "getRadius", w_CircleShape_getRadius },
{ "setRadius", w_CircleShape_setRadius },
{ "getPoint", w_CircleShape_getPoint },
{ "setPoint", w_CircleShape_setPoint },
// From Shape.
{ "getType", w_Shape_getType },
{ "getRadius", w_Shape_getRadius },
{ "getChildCount", w_Shape_getChildCount },
{ "testPoint", w_Shape_testPoint },
{ "rayCast", w_Shape_rayCast },
{ "computeAABB", w_Shape_computeAABB },
{ "computeMass", w_Shape_computeMass },
{ 0, 0 }
};
extern "C" int luaopen_circleshape(lua_State *L)
{
return luax_register_type(L, PHYSICS_CIRCLE_SHAPE_ID, functions);
return luax_register_type(L, PHYSICS_CIRCLE_SHAPE_ID, "CircleShape", w_Shape_functions, w_CircleShape_functions, nullptr);
}
} // box2d
@@ -34,10 +34,6 @@ namespace box2d
{
CircleShape *luax_checkcircleshape(lua_State *L, int idx);
int w_CircleShape_getRadius(lua_State *L);
int w_CircleShape_setRadius(lua_State *L);
int w_CircleShape_getPoint(lua_State *L);
int w_CircleShape_setPoint(lua_State *L);
extern "C" int luaopen_circleshape(lua_State *L);
} // box2d
+22 -22
View File
@@ -158,30 +158,30 @@ int w_Contact_isDestroyed(lua_State *L)
return 1;
}
static const luaL_Reg w_Contact_functions[] =
{
{ "getPositions", w_Contact_getPositions },
{ "getNormal", w_Contact_getNormal },
{ "getFriction", w_Contact_getFriction },
{ "getRestitution", w_Contact_getRestitution },
{ "isEnabled", w_Contact_isEnabled },
{ "isTouching", w_Contact_isTouching },
{ "setFriction", w_Contact_setFriction },
{ "setRestitution", w_Contact_setRestitution },
{ "setEnabled", w_Contact_setEnabled },
{ "resetFriction", w_Contact_resetFriction },
{ "resetRestitution", w_Contact_resetRestitution },
{ "setTangentSpeed", w_Contact_setTangentSpeed },
{ "getTangentSpeed", w_Contact_getTangentSpeed },
{ "getChildren", w_Contact_getChildren },
{ "getFixtures", w_Contact_getFixtures },
{ "isDestroyed", w_Contact_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_contact(lua_State *L)
{
static const luaL_Reg functions[] =
{
{ "getPositions", w_Contact_getPositions },
{ "getNormal", w_Contact_getNormal },
{ "getFriction", w_Contact_getFriction },
{ "getRestitution", w_Contact_getRestitution },
{ "isEnabled", w_Contact_isEnabled },
{ "isTouching", w_Contact_isTouching },
{ "setFriction", w_Contact_setFriction },
{ "setRestitution", w_Contact_setRestitution },
{ "setEnabled", w_Contact_setEnabled },
{ "resetFriction", w_Contact_resetFriction },
{ "resetRestitution", w_Contact_resetRestitution },
{ "setTangentSpeed", w_Contact_setTangentSpeed },
{ "getTangentSpeed", w_Contact_getTangentSpeed },
{ "getChildren", w_Contact_getChildren },
{ "getFixtures", w_Contact_getFixtures },
{ "isDestroyed", w_Contact_isDestroyed },
{ 0, 0 }
};
return luax_register_type(L, PHYSICS_CONTACT_ID, functions);
return luax_register_type(L, PHYSICS_CONTACT_ID, "Contact", w_Contact_functions, nullptr);
}
} // box2d
-16
View File
@@ -33,22 +33,6 @@ namespace box2d
{
Contact *luax_checkcontact(lua_State *L, int idx);
int w_Contact_getPositions(lua_State *L);
int w_Contact_getNormal(lua_State *L);
int w_Contact_getFriction(lua_State *L);
int w_Contact_getRestitution(lua_State *L);
int w_Contact_isEnabled(lua_State *L);
int w_Contact_isTouching(lua_State *L);
int w_Contact_setFriction(lua_State *L);
int w_Contact_setRestitution(lua_State *L);
int w_Contact_setEnabled(lua_State *L);
int w_Contact_resetFriction(lua_State *L);
int w_Contact_resetRestitution(lua_State *L);
int w_Contact_setTangentSpeed(lua_State *L);
int w_Contact_getTangentSpeed(lua_State *L);
int w_Contact_getChildren(lua_State *L);
int w_Contact_getFixtures(lua_State *L);
int w_Contact_isDestroyed(lua_State *L);
extern "C" int luaopen_contact(lua_State *L);
} // box2d
@@ -80,7 +80,7 @@ int w_DistanceJoint_getDampingRatio(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_DistanceJoint_functions[] =
{
{ "setLength", w_DistanceJoint_setLength },
{ "getLength", w_DistanceJoint_getLength },
@@ -88,23 +88,12 @@ static const luaL_Reg functions[] =
{ "getFrequency", w_DistanceJoint_getFrequency },
{ "setDampingRatio", w_DistanceJoint_setDampingRatio },
{ "getDampingRatio", w_DistanceJoint_getDampingRatio },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_distancejoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_DISTANCE_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_DISTANCE_JOINT_ID, "DistanceJoint", w_Joint_functions, w_DistanceJoint_functions, nullptr);
}
} // box2d
@@ -34,12 +34,6 @@ namespace box2d
{
DistanceJoint *luax_checkdistancejoint(lua_State *L, int idx);
int w_DistanceJoint_setLength(lua_State *L);
int w_DistanceJoint_getLength(lua_State *L);
int w_DistanceJoint_setFrequency(lua_State *L);
int w_DistanceJoint_getFrequency(lua_State *L);
int w_DistanceJoint_setDampingRatio(lua_State *L);
int w_DistanceJoint_getDampingRatio(lua_State *L);
extern "C" int luaopen_distancejoint(lua_State *L);
} // box2d
+2 -10
View File
@@ -39,23 +39,15 @@ int w_EdgeShape_getPoints(lua_State *L)
return t->getPoints(L);
}
static const luaL_Reg functions[] =
static const luaL_Reg w_EdgeShape_functions[] =
{
{ "getPoints", w_EdgeShape_getPoints },
// From Shape.
{ "getType", w_Shape_getType },
{ "getRadius", w_Shape_getRadius },
{ "getChildCount", w_Shape_getChildCount },
{ "testPoint", w_Shape_testPoint },
{ "rayCast", w_Shape_rayCast },
{ "computeAABB", w_Shape_computeAABB },
{ "computeMass", w_Shape_computeMass },
{ 0, 0 }
};
extern "C" int luaopen_edgeshape(lua_State *L)
{
return luax_register_type(L, PHYSICS_EDGE_SHAPE_ID, functions);
return luax_register_type(L, PHYSICS_EDGE_SHAPE_ID, "EdgeShape", w_Shape_functions, w_EdgeShape_functions, nullptr);
}
} // box2d
@@ -34,7 +34,6 @@ namespace box2d
{
EdgeShape *luax_checkedgeshape(lua_State *L, int idx);
int w_EdgeShape_getPoints(lua_State *L);
extern "C" int luaopen_edgeshape(lua_State *L);
} // box2d
+2 -2
View File
@@ -269,7 +269,7 @@ int w_Fixture_isDestroyed(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_Fixture_functions[] =
{
{ "getType", w_Fixture_getType },
{ "setFriction", w_Fixture_setFriction },
@@ -303,7 +303,7 @@ static const luaL_Reg functions[] =
extern "C" int luaopen_fixture(lua_State *L)
{
return luax_register_type(L, PHYSICS_FIXTURE_ID, functions);
return luax_register_type(L, PHYSICS_FIXTURE_ID, "Fixture", w_Fixture_functions, nullptr);
}
} // box2d
-27
View File
@@ -34,33 +34,6 @@ namespace box2d
{
Fixture *luax_checkfixture(lua_State *L, int idx);
int w_Fixture_getType(lua_State *L);
int w_Fixture_setFriction(lua_State *L);
int w_Fixture_setRestitution(lua_State *L);
int w_Fixture_setDensity(lua_State *L);
int w_Fixture_setSensor(lua_State *L);
int w_Fixture_getFriction(lua_State *L);
int w_Fixture_getRestitution(lua_State *L);
int w_Fixture_getDensity(lua_State *L);
int w_Fixture_isSensor(lua_State *L);
int w_Fixture_getBody(lua_State *L);
int w_Fixture_getShape(lua_State *L);
int w_Fixture_testPoint(lua_State *L);
int w_Fixture_rayCast(lua_State *L);
int w_Fixture_setFilterData(lua_State *L);
int w_Fixture_getFilterData(lua_State *L);
int w_Fixture_setCategory(lua_State *L);
int w_Fixture_getCategory(lua_State *L);
int w_Fixture_setMask(lua_State *L);
int w_Fixture_getMask(lua_State *L);
int w_Fixture_setUserData(lua_State *L);
int w_Fixture_getUserData(lua_State *L);
int w_Fixture_getBoundingBox(lua_State *L);
int w_Fixture_getMassData(lua_State *L);
int w_Fixture_getGroupIndex(lua_State *L);
int w_Fixture_setGroupIndex(lua_State *L);
int w_Fixture_destroy(lua_State *L);
int w_Fixture_isDestroyed(lua_State *L);
extern "C" int luaopen_fixture(lua_State *L);
} // box2d
@@ -66,29 +66,18 @@ int w_FrictionJoint_getMaxTorque(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_FrictionJoint_functions[] =
{
{ "setMaxForce", w_FrictionJoint_setMaxForce },
{ "getMaxForce", w_FrictionJoint_getMaxForce },
{ "setMaxTorque", w_FrictionJoint_setMaxTorque },
{ "getMaxTorque", w_FrictionJoint_getMaxTorque },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_frictionjoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_FRICTION_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_FRICTION_JOINT_ID, "FrictionJoint", w_Joint_functions, w_FrictionJoint_functions, nullptr);
}
} // box2d
@@ -34,10 +34,6 @@ namespace box2d
{
FrictionJoint *luax_checkfrictionjoint(lua_State *L, int idx);
int w_FrictionJoint_setMaxForce(lua_State *L);
int w_FrictionJoint_getMaxForce(lua_State *L);
int w_FrictionJoint_setMaxTorque(lua_State *L);
int w_FrictionJoint_getMaxTorque(lua_State *L);
extern "C" int luaopen_frictionjoint(lua_State *L);
} // box2d
+2 -13
View File
@@ -67,28 +67,17 @@ int w_GearJoint_getJoints(lua_State *L)
return 2;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_GearJoint_functions[] =
{
{ "setRatio", w_GearJoint_setRatio },
{ "getRatio", w_GearJoint_getRatio },
{ "getJoints", w_GearJoint_getJoints },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_gearjoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_GEAR_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_GEAR_JOINT_ID, "GearJoint", w_Joint_functions, w_GearJoint_functions, nullptr);
}
} // box2d
@@ -34,9 +34,6 @@ namespace box2d
{
GearJoint *luax_checkgearjoint(lua_State *L, int idx);
int w_GearJoint_setRatio(lua_State *L);
int w_GearJoint_getRatio(lua_State *L);
int w_GearJoint_getJoints(lua_State *L);
extern "C" int luaopen_gearjoint(lua_State *L);
} // box2d
+2 -2
View File
@@ -154,7 +154,7 @@ int w_Joint_isDestroyed(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
const luaL_Reg w_Joint_functions[] =
{
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
@@ -171,7 +171,7 @@ static const luaL_Reg functions[] =
extern "C" int luaopen_joint(lua_State *L)
{
return luax_register_type(L, PHYSICS_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_JOINT_ID, "Joint", w_Joint_functions, nullptr);
}
} // box2d
+2 -10
View File
@@ -34,18 +34,10 @@ namespace box2d
void luax_pushjoint(lua_State *L, Joint *j);
Joint *luax_checkjoint(lua_State *L, int idx);
int w_Joint_getType(lua_State *L);
int w_Joint_getBodies(lua_State *L);
int w_Joint_getAnchors(lua_State *L);
int w_Joint_getReactionForce(lua_State *L);
int w_Joint_getReactionTorque(lua_State *L);
int w_Joint_getCollideConnected(lua_State *L);
int w_Joint_setUserData(lua_State *L);
int w_Joint_getUserData(lua_State *L);
int w_Joint_destroy(lua_State *L);
int w_Joint_isDestroyed(lua_State *L);
extern "C" int luaopen_joint(lua_State *L);
extern const luaL_Reg w_Joint_functions[];
} // box2d
} // physics
} // love
+2 -13
View File
@@ -110,7 +110,7 @@ int w_MotorJoint_getCorrectionFactor(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_MotorJoint_functions[] =
{
{ "setLinearOffset", w_MotorJoint_setLinearOffset },
{ "getLinearOffset", w_MotorJoint_getLinearOffset },
@@ -122,23 +122,12 @@ static const luaL_Reg functions[] =
{ "getMaxTorque", w_MotorJoint_getMaxTorque },
{ "setCorrectionFactor", w_MotorJoint_setCorrectionFactor },
{ "getCorrectionFactor", w_MotorJoint_getCorrectionFactor },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_motorjoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_MOTOR_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_MOTOR_JOINT_ID, "MotorJoint", w_Joint_functions, w_MotorJoint_functions, nullptr);
}
@@ -34,16 +34,6 @@ namespace box2d
{
MotorJoint *luax_checkmotorjoint(lua_State *L, int idx);
int w_MotorJoint_setLinearOffset(lua_State *L);
int w_MotorJoint_getLinearOffset(lua_State *L);
int w_MotorJoint_setAngularOffset(lua_State *L);
int w_MotorJoint_getAngularOffset(lua_State *L);
int w_MotorJoint_setMaxForce(lua_State *L);
int w_MotorJoint_getMaxForce(lua_State *L);
int w_MotorJoint_setMaxTorque(lua_State *L);
int w_MotorJoint_getMaxTorque(lua_State *L);
int w_MotorJoint_setCorrectionFactor(lua_State *L);
int w_MotorJoint_getCorrectionFactor(lua_State *L);
extern "C" int luaopen_motorjoint(lua_State *L);
} // box2d
+2 -13
View File
@@ -96,7 +96,7 @@ int w_MouseJoint_getDampingRatio(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_MouseJoint_functions[] =
{
{ "setTarget", w_MouseJoint_setTarget },
{ "getTarget", w_MouseJoint_getTarget },
@@ -106,23 +106,12 @@ static const luaL_Reg functions[] =
{ "getFrequency", w_MouseJoint_getFrequency },
{ "setDampingRatio", w_MouseJoint_setDampingRatio },
{ "getDampingRatio", w_MouseJoint_getDampingRatio },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_mousejoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_MOUSE_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_MOUSE_JOINT_ID, "MouseJoint", w_Joint_functions, w_MouseJoint_functions, nullptr);
}
} // box2d
@@ -34,14 +34,6 @@ namespace box2d
{
MouseJoint *luax_checkmousejoint(lua_State *L, int idx);
int w_MouseJoint_setTarget(lua_State *L);
int w_MouseJoint_getTarget(lua_State *L);
int w_MouseJoint_setMaxForce(lua_State *L);
int w_MouseJoint_getMaxForce(lua_State *L);
int w_MouseJoint_setFrequency(lua_State *L);
int w_MouseJoint_getFrequency(lua_State *L);
int w_MouseJoint_setDampingRatio(lua_State *L);
int w_MouseJoint_getDampingRatio(lua_State *L);
extern "C" int luaopen_mousejoint(lua_State *L);
} // box2d
-22
View File
@@ -32,28 +32,6 @@ namespace physics
namespace box2d
{
int w_newWorld(lua_State *L);
int w_newBody(lua_State *L);
int w_newFixture(lua_State *L);
int w_newCircleShape(lua_State *L);
int w_newRectangleShape(lua_State *L);
int w_newPolygonShape(lua_State *L);
int w_newEdgeShape(lua_State *L);
int w_newChainShape(lua_State *L);
int w_newDistanceJoint(lua_State *L);
int w_newMouseJoint(lua_State *L);
int w_newRevoluteJoint(lua_State *L);
int w_newPrismaticJoint(lua_State *L);
int w_newPulleyJoint(lua_State *L);
int w_newGearJoint(lua_State *L);
int w_newFrictionJoint(lua_State *L);
int w_newWeldJoint(lua_State *L);
int w_newWheelJoint(lua_State *L);
int w_newRopeJoint(lua_State *L);
int w_newMotorJoint(lua_State *L);
int w_getDistance(lua_State *L);
int w_setMeter(lua_State *L);
int w_getMeter(lua_State *L);
extern "C" LOVE_EXPORT int luaopen_love_physics(lua_State *L);
} // box2d
@@ -46,24 +46,16 @@ int w_PolygonShape_validate(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_PolygonShape_functions[] =
{
{ "getPoints", w_PolygonShape_getPoints },
{ "validate", w_PolygonShape_validate },
// From Shape.
{ "getType", w_Shape_getType },
{ "getRadius", w_Shape_getRadius },
{ "getChildCount", w_Shape_getChildCount },
{ "testPoint", w_Shape_testPoint },
{ "rayCast", w_Shape_rayCast },
{ "computeAABB", w_Shape_computeAABB },
{ "computeMass", w_Shape_computeMass },
{ 0, 0 }
};
extern "C" int luaopen_polygonshape(lua_State *L)
{
return luax_register_type(L, PHYSICS_POLYGON_SHAPE_ID, functions);
return luax_register_type(L, PHYSICS_POLYGON_SHAPE_ID, "PolygonShape", w_Shape_functions, w_PolygonShape_functions, nullptr);
}
} // box2d
@@ -34,8 +34,6 @@ namespace box2d
{
PolygonShape *luax_checkpolygonshape(lua_State *L, int idx);
int w_PolygonShape_getPoints(lua_State *L);
int w_PolygonShape_validate(lua_State *L);
extern "C" int luaopen_polygonshape(lua_State *L);
} // box2d
@@ -164,7 +164,7 @@ int w_PrismaticJoint_getLimits(lua_State *L)
return t->getLimits(L);
}
static const luaL_Reg functions[] =
static const luaL_Reg w_PrismaticJoint_functions[] =
{
{ "getJointTranslation", w_PrismaticJoint_getJointTranslation },
{ "getJointSpeed", w_PrismaticJoint_getJointSpeed },
@@ -183,23 +183,12 @@ static const luaL_Reg functions[] =
{ "getLowerLimit", w_PrismaticJoint_getLowerLimit },
{ "getUpperLimit", w_PrismaticJoint_getUpperLimit },
{ "getLimits", w_PrismaticJoint_getLimits },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_prismaticjoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_PRISMATIC_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_PRISMATIC_JOINT_ID, "PrismaticJoint", w_Joint_functions, w_PrismaticJoint_functions, nullptr);
}
} // box2d
@@ -34,23 +34,6 @@ namespace box2d
{
PrismaticJoint *luax_checkprismaticjoint(lua_State *L, int idx);
int w_PrismaticJoint_getJointTranslation(lua_State *L);
int w_PrismaticJoint_getJointSpeed(lua_State *L);
int w_PrismaticJoint_setMotorEnabled(lua_State *L);
int w_PrismaticJoint_isMotorEnabled(lua_State *L);
int w_PrismaticJoint_setMaxMotorForce(lua_State *L);
int w_PrismaticJoint_setMotorSpeed(lua_State *L);
int w_PrismaticJoint_getMotorSpeed(lua_State *L);
int w_PrismaticJoint_getMotorForce(lua_State *L);
int w_PrismaticJoint_getMaxMotorForce(lua_State *L);
int w_PrismaticJoint_setLimitsEnabled(lua_State *L);
int w_PrismaticJoint_hasLimitsEnabled(lua_State *L);
int w_PrismaticJoint_setUpperLimit(lua_State *L);
int w_PrismaticJoint_setLowerLimit(lua_State *L);
int w_PrismaticJoint_setLimits(lua_State *L);
int w_PrismaticJoint_getLowerLimit(lua_State *L);
int w_PrismaticJoint_getUpperLimit(lua_State *L);
int w_PrismaticJoint_getLimits(lua_State *L);
extern "C" int luaopen_prismaticjoint(lua_State *L);
} // box2d
+2 -13
View File
@@ -63,29 +63,18 @@ int w_PulleyJoint_getRatio(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_PulleyJoint_functions[] =
{
{ "getGroundAnchors", w_PulleyJoint_getGroundAnchors },
{ "getLengthA", w_PulleyJoint_getLengthA },
{ "getLengthB", w_PulleyJoint_getLengthB },
{ "getRatio", w_PulleyJoint_getRatio },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_pulleyjoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_PULLEY_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_PULLEY_JOINT_ID, "PulleyJoint", w_Joint_functions, w_PulleyJoint_functions, nullptr);
}
} // box2d
@@ -34,10 +34,6 @@ namespace box2d
{
PulleyJoint *luax_checkpulleyjoint(lua_State *L, int idx);
int w_PulleyJoint_getGroundAnchors(lua_State *L);
int w_PulleyJoint_getLengthA(lua_State *L);
int w_PulleyJoint_getLengthB(lua_State *L);
int w_PulleyJoint_getRatio(lua_State *L);
extern "C" int luaopen_pulleyjoint(lua_State *L);
} // box2d
@@ -164,7 +164,7 @@ int w_RevoluteJoint_getLimits(lua_State *L)
return t->getLimits(L);
}
static const luaL_Reg functions[] =
static const luaL_Reg w_RevoluteJoint_functions[] =
{
{ "getJointAngle", w_RevoluteJoint_getJointAngle },
{ "getJointSpeed", w_RevoluteJoint_getJointSpeed },
@@ -183,23 +183,12 @@ static const luaL_Reg functions[] =
{ "getLowerLimit", w_RevoluteJoint_getLowerLimit },
{ "getUpperLimit", w_RevoluteJoint_getUpperLimit },
{ "getLimits", w_RevoluteJoint_getLimits },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_revolutejoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_REVOLUTE_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_REVOLUTE_JOINT_ID, "RevoluteJoint", w_Joint_functions, w_RevoluteJoint_functions, nullptr);
}
} // box2d
@@ -34,23 +34,6 @@ namespace box2d
{
RevoluteJoint *luax_checkrevolutejoint(lua_State *L, int idx);
int w_RevoluteJoint_getJointAngle(lua_State *L);
int w_RevoluteJoint_getJointSpeed(lua_State *L);
int w_RevoluteJoint_setMotorEnabled(lua_State *L);
int w_RevoluteJoint_isMotorEnabled(lua_State *L);
int w_RevoluteJoint_setMaxMotorTorque(lua_State *L);
int w_RevoluteJoint_setMotorSpeed(lua_State *L);
int w_RevoluteJoint_getMotorSpeed(lua_State *L);
int w_RevoluteJoint_getMotorTorque(lua_State *L);
int w_RevoluteJoint_getMaxMotorTorque(lua_State *L);
int w_RevoluteJoint_setLimitsEnabled(lua_State *L);
int w_RevoluteJoint_hasLimitsEnabled(lua_State *L);
int w_RevoluteJoint_setUpperLimit(lua_State *L);
int w_RevoluteJoint_setLowerLimit(lua_State *L);
int w_RevoluteJoint_setLimits(lua_State *L);
int w_RevoluteJoint_getLowerLimit(lua_State *L);
int w_RevoluteJoint_getUpperLimit(lua_State *L);
int w_RevoluteJoint_getLimits(lua_State *L);
extern "C" int luaopen_revolutejoint(lua_State *L);
} // box2d
+2 -13
View File
@@ -42,26 +42,15 @@ int w_RopeJoint_getMaxLength(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_RopeJoint_functions[] =
{
{ "getMaxLength", w_RopeJoint_getMaxLength },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_ropejoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_ROPE_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_ROPE_JOINT_ID, "RopeJoint", w_Joint_functions, w_RopeJoint_functions, nullptr);
}
} // box2d
@@ -34,7 +34,6 @@ namespace box2d
{
RopeJoint *luax_checkropejoint(lua_State *L, int idx);
int w_RopeJoint_getMaxLength(lua_State *L);
extern "C" int luaopen_ropejoint(lua_State *L);
} // box2d
+2 -2
View File
@@ -94,7 +94,7 @@ int w_Shape_computeMass(lua_State *L)
return t->computeMass(L);
}
static const luaL_Reg functions[] =
const luaL_Reg w_Shape_functions[] =
{
{ "getType", w_Shape_getType },
{ "getRadius", w_Shape_getRadius },
@@ -108,7 +108,7 @@ static const luaL_Reg functions[] =
extern "C" int luaopen_shape(lua_State *L)
{
return luax_register_type(L, PHYSICS_SHAPE_ID, functions);
return luax_register_type(L, PHYSICS_SHAPE_ID, "Shape", w_Shape_functions, nullptr);
}
} // box2d
+2 -9
View File
@@ -34,17 +34,10 @@ namespace box2d
{
Shape *luax_checkshape(lua_State *L, int idx);
int w_Shape_getType(lua_State *L);
int w_Shape_getRadius(lua_State *L);
int w_Shape_getChildCount(lua_State *L);
int w_Shape_testPoint(lua_State *L);
int w_Shape_rayCast(lua_State *L);
int w_Shape_computeAABB(lua_State *L);
int w_Shape_computeMass(lua_State *L);
extern "C" int luaopen_shape(lua_State *L);
extern const luaL_Reg w_Shape_functions[];
} // box2d
} // physics
} // love
+2 -13
View File
@@ -65,29 +65,18 @@ int w_WeldJoint_getDampingRatio(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_WeldJoint_functions[] =
{
{ "setFrequency", w_WeldJoint_setFrequency },
{ "getFrequency", w_WeldJoint_getFrequency },
{ "setDampingRatio", w_WeldJoint_setDampingRatio },
{ "getDampingRatio", w_WeldJoint_getDampingRatio },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_weldjoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_WELD_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_WELD_JOINT_ID, "WeldJoint", w_Joint_functions, w_WeldJoint_functions, nullptr);
}
} // box2d
@@ -34,12 +34,6 @@ namespace box2d
{
WeldJoint *luax_checkweldjoint(lua_State *L, int idx);
int w_WeldJoint_setFrequency(lua_State *L);
int w_WeldJoint_getFrequency(lua_State *L);
int w_WeldJoint_setDampingRatio(lua_State *L);
int w_WeldJoint_getDampingRatio(lua_State *L);
extern "C" int luaopen_weldjoint(lua_State *L);
} // box2d
+2 -13
View File
@@ -132,7 +132,7 @@ int w_WheelJoint_getSpringDampingRatio(lua_State *L)
return 1;
}
static const luaL_Reg functions[] =
static const luaL_Reg w_WheelJoint_functions[] =
{
{ "getJointTranslation", w_WheelJoint_getJointTranslation },
{ "getJointSpeed", w_WheelJoint_getJointSpeed },
@@ -147,23 +147,12 @@ static const luaL_Reg functions[] =
{ "getSpringFrequency", w_WheelJoint_getSpringFrequency },
{ "setSpringDampingRatio", w_WheelJoint_setSpringDampingRatio },
{ "getSpringDampingRatio", w_WheelJoint_getSpringDampingRatio },
// From Joint.
{ "getType", w_Joint_getType },
{ "getBodies", w_Joint_getBodies },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
extern "C" int luaopen_wheeljoint(lua_State *L)
{
return luax_register_type(L, PHYSICS_WHEEL_JOINT_ID, functions);
return luax_register_type(L, PHYSICS_WHEEL_JOINT_ID, "WheelJoint", w_Joint_functions, w_WheelJoint_functions, nullptr);
}
} // box2d
@@ -34,19 +34,6 @@ namespace box2d
{
WheelJoint *luax_checkwheeljoint(lua_State *L, int idx);
int w_WheelJoint_getJointTranslation(lua_State *L);
int w_WheelJoint_getJointSpeed(lua_State *L);
int w_WheelJoint_setMotorEnabled(lua_State *L);
int w_WheelJoint_isMotorEnabled(lua_State *L);
int w_WheelJoint_setMotorSpeed(lua_State *L);
int w_WheelJoint_getMotorSpeed(lua_State *L);
int w_WheelJoint_setMaxMotorTorque(lua_State *L);
int w_WheelJoint_getMaxMotorTorque(lua_State *L);
int w_WheelJoint_getMotorTorque(lua_State *L);
int w_WheelJoint_setSpringFrequency(lua_State *L);
int w_WheelJoint_getSpringFrequency(lua_State *L);
int w_WheelJoint_setSpringDampingRatio(lua_State *L);
int w_WheelJoint_getSpringDampingRatio(lua_State *L);
extern "C" int luaopen_wheeljoint(lua_State *L);
} // box2d
+2 -2
View File
@@ -199,7 +199,7 @@ int w_World_isDestroyed(lua_State *L)
}
static const luaL_Reg functions[] =
static const luaL_Reg w_World_functions[] =
{
{ "update", w_World_update },
{ "setCallbacks", w_World_setCallbacks },
@@ -227,7 +227,7 @@ static const luaL_Reg functions[] =
extern "C" int luaopen_world(lua_State *L)
{
return luax_register_type(L, PHYSICS_WORLD_ID, functions);
return luax_register_type(L, PHYSICS_WORLD_ID, "World", w_World_functions, nullptr);
}
} // box2d
-21
View File
@@ -35,27 +35,6 @@ namespace box2d
{
World *luax_checkworld(lua_State *L, int idx);
int w_World_update(lua_State *L);
int w_World_setCallbacks(lua_State *L);
int w_World_getCallbacks(lua_State *L);
int w_World_setContactFilter(lua_State *L);
int w_World_getContactFilter(lua_State *L);
int w_World_setGravity(lua_State *L);
int w_World_getGravity(lua_State *L);
int w_World_translateOrigin(lua_State *L);
int w_World_setSleepingAllowed(lua_State *L);
int w_World_isSleepingAllowed(lua_State *L);
int w_World_isLocked(lua_State *L);
int w_World_getBodyCount(lua_State *L);
int w_World_getJointCount(lua_State *L);
int w_World_getContactCount(lua_State *L);
int w_World_getBodyList(lua_State *L);
int w_World_getJointList(lua_State *L);
int w_World_getContactList(lua_State *L);
int w_World_queryBoundingBox(lua_State *L);
int w_World_rayCast(lua_State *L);
int w_World_destroy(lua_State *L);
int w_World_isDestroyed(lua_State *L);
extern "C" int luaopen_world(lua_State *L);
} // box2d