Added many comments, and changed function names for wrapper functions.

This commit is contained in:
rude
2009-08-09 21:08:55 +02:00
parent f2adfd53f2
commit ba1a75e547
103 changed files with 2608 additions and 2391 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ namespace box2d
PolygonShape * p = new PolygonShape(b, &def);
luax_newtype(L, "PolygonShape", LOVE_PHYSICS_POLYGON_SHAPE_BITS, (void*)p);
luax_newtype(L, "PolygonShape", PHYSICS_POLYGON_SHAPE_T, (void*)p);
return 1;
}
+1 -1
View File
@@ -85,7 +85,7 @@ namespace box2d
lua_pushnil(L);
}
luax_newtype(L, "Contact", (LOVE_PHYSICS_CONTACT_BITS), (void*)add_contacts[i], false);
luax_newtype(L, "Contact", (PHYSICS_CONTACT_T), (void*)add_contacts[i], false);
lua_call(L, 3, 0);
}
+86 -88
View File
@@ -28,90 +28,90 @@ namespace box2d
{
Body * luax_checkbody(lua_State * L, int idx)
{
return luax_checktype<Body>(L, idx, "Body", LOVE_PHYSICS_BODY_BITS);
return luax_checktype<Body>(L, idx, "Body", PHYSICS_BODY_T);
}
int _wrap_Body_getX(lua_State * L)
int w_Body_getX(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getX());
return 1;
}
int _wrap_Body_getY(lua_State * L)
int w_Body_getY(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getY());
return 1;
}
int _wrap_Body_getAngle(lua_State * L)
int w_Body_getAngle(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getAngle());
return 1;
}
int _wrap_Body_getPosition(lua_State * L)
int w_Body_getPosition(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getPosition(L);
}
int _wrap_Body_getLinearVelocity(lua_State * L)
int w_Body_getLinearVelocity(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getLinearVelocity(L);
}
int _wrap_Body_getWorldCenter(lua_State * L)
int w_Body_getWorldCenter(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getWorldCenter(L);
}
int _wrap_Body_getLocalCenter(lua_State * L)
int w_Body_getLocalCenter(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getLocalCenter(L);
}
int _wrap_Body_getAngularVelocity(lua_State * L)
int w_Body_getAngularVelocity(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getAngularVelocity());
return 1;
}
int _wrap_Body_getMass(lua_State * L)
int w_Body_getMass(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getMass());
return 1;
}
int _wrap_Body_getInertia(lua_State * L)
int w_Body_getInertia(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getInertia());
return 1;
}
int _wrap_Body_getAngularDamping(lua_State * L)
int w_Body_getAngularDamping(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getAngularDamping());
return 1;
}
int _wrap_Body_getLinearDamping(lua_State * L)
int w_Body_getLinearDamping(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getLinearDamping());
return 1;
}
int _wrap_Body_applyImpulse(lua_State * L)
int w_Body_applyImpulse(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float jx = (float)luaL_checknumber(L, 2);
@@ -122,7 +122,7 @@ namespace box2d
return 0;
}
int _wrap_Body_applyTorque(lua_State * L)
int w_Body_applyTorque(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg = (float)luaL_checknumber(L, 2);
@@ -130,7 +130,7 @@ namespace box2d
return 0;
}
int _wrap_Body_applyForce(lua_State * L)
int w_Body_applyForce(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float fx = (float)luaL_checknumber(L, 2);
@@ -141,7 +141,7 @@ namespace box2d
return 0;
}
int _wrap_Body_setX(lua_State * L)
int w_Body_setX(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -149,7 +149,7 @@ namespace box2d
return 0;
}
int _wrap_Body_setY(lua_State * L)
int w_Body_setY(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -157,7 +157,7 @@ namespace box2d
return 0;
}
int _wrap_Body_setLinearVelocity(lua_State * L)
int w_Body_setLinearVelocity(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -166,7 +166,7 @@ namespace box2d
return 0;
}
int _wrap_Body_setAngle(lua_State * L)
int w_Body_setAngle(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -174,7 +174,7 @@ namespace box2d
return 0;
}
int _wrap_Body_setAngularVelocity(lua_State * L)
int w_Body_setAngularVelocity(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -182,7 +182,7 @@ namespace box2d
return 0;
}
int _wrap_Body_setPosition(lua_State * L)
int w_Body_setPosition(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -191,14 +191,14 @@ namespace box2d
return 0;
}
int _wrap_Body_setMassFromShapes(lua_State * L)
int w_Body_setMassFromShapes(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
t->setMassFromShapes();
return 0;
}
int _wrap_Body_setMass(lua_State * L)
int w_Body_setMass(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float x = (float)luaL_checknumber(L, 2);
@@ -209,7 +209,7 @@ namespace box2d
return 0;
}
int _wrap_Body_setAngularDamping(lua_State * L)
int w_Body_setAngularDamping(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -217,7 +217,7 @@ namespace box2d
return 0;
}
int _wrap_Body_setLinearDamping(lua_State * L)
int w_Body_setLinearDamping(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -225,50 +225,50 @@ namespace box2d
return 0;
}
int _wrap_Body_getWorldPoint(lua_State * L)
int w_Body_getWorldPoint(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getWorldPoint(L);
}
int _wrap_Body_getWorldVector(lua_State * L)
int w_Body_getWorldVector(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getWorldVector(L);
}
int _wrap_Body_getLocalPoint(lua_State * L)
int w_Body_getLocalPoint(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getLocalPoint(L);
}
int _wrap_Body_getLocalVector(lua_State * L)
int w_Body_getLocalVector(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getLocalVector(L);
}
int _wrap_Body_getLinearVelocityFromWorldPoint(lua_State * L)
int w_Body_getLinearVelocityFromWorldPoint(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getLinearVelocityFromWorldPoint(L);
}
int _wrap_Body_getLinearVelocityFromLocalPoint(lua_State * L)
int w_Body_getLinearVelocityFromLocalPoint(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getLinearVelocityFromLocalPoint(L);
}
int _wrap_Body_isBullet(lua_State * L)
int w_Body_isBullet(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
luax_pushboolean(L, t->isBullet());
return 1;
}
int _wrap_Body_setBullet(lua_State * L)
int w_Body_setBullet(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
bool b = luax_toboolean(L, 2);
@@ -276,35 +276,35 @@ namespace box2d
return 0;
}
int _wrap_Body_isStatic(lua_State * L)
int w_Body_isStatic(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
luax_pushboolean(L, t->isStatic());
return 1;
}
int _wrap_Body_isDynamic(lua_State * L)
int w_Body_isDynamic(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
luax_pushboolean(L, t->isDynamic());
return 1;
}
int _wrap_Body_isFrozen(lua_State * L)
int w_Body_isFrozen(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
luax_pushboolean(L, t->isFrozen());
return 1;
}
int _wrap_Body_isSleeping(lua_State * L)
int w_Body_isSleeping(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
luax_pushboolean(L, t->isSleeping());
return 1;
}
int _wrap_Body_setAllowSleeping(lua_State * L)
int w_Body_setAllowSleeping(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
bool b = luax_toboolean(L, 2);
@@ -312,68 +312,66 @@ namespace box2d
return 0;
}
int _wrap_Body_putToSleep(lua_State * L)
int w_Body_putToSleep(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
t->putToSleep();
return 0;
}
int _wrap_Body_wakeUp(lua_State * L)
int w_Body_wakeUp(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
t->wakeUp();
return 0;
}
static const luaL_Reg wrap_Body_functions[] = {
{ "getX", _wrap_Body_getX },
{ "getY", _wrap_Body_getY },
{ "getAngle", _wrap_Body_getAngle },
{ "getPosition", _wrap_Body_getPosition },
{ "getLinearVelocity", _wrap_Body_getLinearVelocity },
{ "getWorldCenter", _wrap_Body_getWorldCenter },
{ "getLocalCenter", _wrap_Body_getLocalCenter },
{ "getAngularVelocity", _wrap_Body_getAngularVelocity },
{ "getMass", _wrap_Body_getMass },
{ "getInertia", _wrap_Body_getInertia },
{ "getAngularDamping", _wrap_Body_getAngularDamping },
{ "getLinearDamping", _wrap_Body_getLinearDamping },
{ "applyImpulse", _wrap_Body_applyImpulse },
{ "applyTorque", _wrap_Body_applyTorque },
{ "applyForce", _wrap_Body_applyForce },
{ "setX", _wrap_Body_setX },
{ "setY", _wrap_Body_setY },
{ "setLinearVelocity", _wrap_Body_setLinearVelocity },
{ "setAngle", _wrap_Body_setAngle },
{ "setAngularVelocity", _wrap_Body_setAngularVelocity },
{ "setPosition", _wrap_Body_setPosition },
{ "setMassFromShapes", _wrap_Body_setMassFromShapes },
{ "setMass", _wrap_Body_setMass },
{ "setAngularDamping", _wrap_Body_setAngularDamping },
{ "setLinearDamping", _wrap_Body_setLinearDamping },
{ "getWorldPoint", _wrap_Body_getWorldPoint },
{ "getWorldVector", _wrap_Body_getWorldVector },
{ "getLocalPoint", _wrap_Body_getLocalPoint },
{ "getLocalVector", _wrap_Body_getLocalVector },
{ "getLinearVelocityFromWorldPoint", _wrap_Body_getLinearVelocityFromWorldPoint },
{ "getLinearVelocityFromLocalPoint", _wrap_Body_getLinearVelocityFromLocalPoint },
{ "isBullet", _wrap_Body_isBullet },
{ "setBullet", _wrap_Body_setBullet },
{ "isStatic", _wrap_Body_isStatic },
{ "isDynamic", _wrap_Body_isDynamic },
{ "isFrozen", _wrap_Body_isFrozen },
{ "isSleeping", _wrap_Body_isSleeping },
{ "setAllowSleeping", _wrap_Body_setAllowSleeping },
{ "putToSleep", _wrap_Body_putToSleep },
{ "wakeUp", _wrap_Body_wakeUp },
{ 0, 0 }
};
int wrap_Body_open(lua_State * L)
int luaopen_body(lua_State * L)
{
luax_register_type(L, "Body", wrap_Body_functions);
return 0;
static const luaL_Reg functions[] = {
{ "getX", w_Body_getX },
{ "getY", w_Body_getY },
{ "getAngle", w_Body_getAngle },
{ "getPosition", w_Body_getPosition },
{ "getLinearVelocity", w_Body_getLinearVelocity },
{ "getWorldCenter", w_Body_getWorldCenter },
{ "getLocalCenter", w_Body_getLocalCenter },
{ "getAngularVelocity", w_Body_getAngularVelocity },
{ "getMass", w_Body_getMass },
{ "getInertia", w_Body_getInertia },
{ "getAngularDamping", w_Body_getAngularDamping },
{ "getLinearDamping", w_Body_getLinearDamping },
{ "applyImpulse", w_Body_applyImpulse },
{ "applyTorque", w_Body_applyTorque },
{ "applyForce", w_Body_applyForce },
{ "setX", w_Body_setX },
{ "setY", w_Body_setY },
{ "setLinearVelocity", w_Body_setLinearVelocity },
{ "setAngle", w_Body_setAngle },
{ "setAngularVelocity", w_Body_setAngularVelocity },
{ "setPosition", w_Body_setPosition },
{ "setMassFromShapes", w_Body_setMassFromShapes },
{ "setMass", w_Body_setMass },
{ "setAngularDamping", w_Body_setAngularDamping },
{ "setLinearDamping", w_Body_setLinearDamping },
{ "getWorldPoint", w_Body_getWorldPoint },
{ "getWorldVector", w_Body_getWorldVector },
{ "getLocalPoint", w_Body_getLocalPoint },
{ "getLocalVector", w_Body_getLocalVector },
{ "getLinearVelocityFromWorldPoint", w_Body_getLinearVelocityFromWorldPoint },
{ "getLinearVelocityFromLocalPoint", w_Body_getLinearVelocityFromLocalPoint },
{ "isBullet", w_Body_isBullet },
{ "setBullet", w_Body_setBullet },
{ "isStatic", w_Body_isStatic },
{ "isDynamic", w_Body_isDynamic },
{ "isFrozen", w_Body_isFrozen },
{ "isSleeping", w_Body_isSleeping },
{ "setAllowSleeping", w_Body_setAllowSleeping },
{ "putToSleep", w_Body_putToSleep },
{ "wakeUp", w_Body_wakeUp },
{ 0, 0 }
};
return luax_register_type(L, "Body", functions);
}
} // box2d
+41 -41
View File
@@ -33,47 +33,47 @@ namespace box2d
{
Body * luax_checkbody(lua_State * L, int idx);
int _wrap_Body_getX(lua_State * L);
int _wrap_Body_getY(lua_State * L);
int _wrap_Body_getAngle(lua_State * L);
int _wrap_Body_getPosition(lua_State * L);
int _wrap_Body_getLinearVelocity(lua_State * L);
int _wrap_Body_getWorldCenter(lua_State * L);
int _wrap_Body_getLocalCenter(lua_State * L);
int _wrap_Body_getAngularVelocity(lua_State * L);
int _wrap_Body_getMass(lua_State * L);
int _wrap_Body_getInertia(lua_State * L);
int _wrap_Body_getAngularDamping(lua_State * L);
int _wrap_Body_getLinearDamping(lua_State * L);
int _wrap_Body_applyImpulse(lua_State * L);
int _wrap_Body_applyTorque(lua_State * L);
int _wrap_Body_applyForce(lua_State * L);
int _wrap_Body_setX(lua_State * L);
int _wrap_Body_setY(lua_State * L);
int _wrap_Body_setVelocity(lua_State * L);
int _wrap_Body_setAngle(lua_State * L);
int _wrap_Body_setAngularVelocity(lua_State * L);
int _wrap_Body_setPosition(lua_State * L);
int _wrap_Body_setMassFromShapes(lua_State * L);
int _wrap_Body_setMass(lua_State * L);
int _wrap_Body_setAngularDamping(lua_State * L);
int _wrap_Body_setLinearDamping(lua_State * L);
int _wrap_Body_getWorldPoint(lua_State * L);
int _wrap_Body_getWorldVector(lua_State * L);
int _wrap_Body_getLocalPoint(lua_State * L);
int _wrap_Body_getLocalVector(lua_State * L);
int _wrap_Body_getLinearVelocityFromWorldPoint(lua_State * L);
int _wrap_Body_getLinearVelocityFromLocalPoint(lua_State * L);
int _wrap_Body_isBullet(lua_State * L);
int _wrap_Body_setBullet(lua_State * L);
int _wrap_Body_isStatic(lua_State * L);
int _wrap_Body_isDynamic(lua_State * L);
int _wrap_Body_isFrozen(lua_State * L);
int _wrap_Body_isSleeping(lua_State * L);
int _wrap_Body_setAllowSleeping(lua_State * L);
int _wrap_Body_putToSleep(lua_State * L);
int _wrap_Body_wakeUp(lua_State * L);
int wrap_Body_open(lua_State * L);
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_getAngularDamping(lua_State * L);
int w_Body_getLinearDamping(lua_State * L);
int w_Body_applyImpulse(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_setVelocity(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_setMassFromShapes(lua_State * L);
int w_Body_setMass(lua_State * L);
int w_Body_setAngularDamping(lua_State * L);
int w_Body_setLinearDamping(lua_State * L);
int w_Body_getWorldPoint(lua_State * L);
int w_Body_getWorldVector(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_isStatic(lua_State * L);
int w_Body_isDynamic(lua_State * L);
int w_Body_isFrozen(lua_State * L);
int w_Body_isSleeping(lua_State * L);
int w_Body_setAllowSleeping(lua_State * L);
int w_Body_putToSleep(lua_State * L);
int w_Body_wakeUp(lua_State * L);
int luaopen_body(lua_State * L);
} // box2d
} // physics
+26 -27
View File
@@ -28,42 +28,41 @@ namespace box2d
{
CircleShape * luax_checkcircleshape(lua_State * L, int idx)
{
return luax_checktype<CircleShape>(L, idx, "CircleShape", LOVE_PHYSICS_CIRCLE_SHAPE_BITS);
return luax_checktype<CircleShape>(L, idx, "CircleShape", PHYSICS_CIRCLE_SHAPE_T);
}
int _wrap_CircleShape_getRadius(lua_State * L)
int w_CircleShape_getRadius(lua_State * L)
{
CircleShape * c = luax_checkcircleshape(L, 1);
lua_pushnumber(L, c->getRadius());
return 1;
}
static const luaL_Reg wrap_CircleShape_functions[] = {
{ "getRadius", _wrap_CircleShape_getRadius },
// From Shape.
{ "getType", _wrap_Shape_getType },
{ "setFriction", _wrap_Shape_setFriction },
{ "setRestitution", _wrap_Shape_setRestitution },
{ "setDensity", _wrap_Shape_setDensity },
{ "setSensor", _wrap_Shape_setSensor },
{ "getFriction", _wrap_Shape_getFriction },
{ "getRestituion", _wrap_Shape_getRestituion },
{ "getDensity", _wrap_Shape_getDensity },
{ "isSensor", _wrap_Shape_isSensor },
{ "testPoint", _wrap_Shape_testPoint },
{ "testSegment", _wrap_Shape_testSegment },
{ "setFilterData", _wrap_Shape_setFilterData },
{ "getFilterData", _wrap_Shape_getFilterData },
{ "setData", _wrap_Shape_setData },
{ "getData", _wrap_Shape_getData },
{ "getBoundingBox", _wrap_Shape_getBoundingBox },
{ 0, 0 }
};
int wrap_CircleShape_open(lua_State * L)
int luaopen_circleshape(lua_State * L)
{
luax_register_type(L, "CircleShape", wrap_CircleShape_functions);
return 0;
static const luaL_Reg functions[] = {
{ "getRadius", w_CircleShape_getRadius },
// From Shape.
{ "getType", w_Shape_getType },
{ "setFriction", w_Shape_setFriction },
{ "setRestitution", w_Shape_setRestitution },
{ "setDensity", w_Shape_setDensity },
{ "setSensor", w_Shape_setSensor },
{ "getFriction", w_Shape_getFriction },
{ "getRestituion", w_Shape_getRestituion },
{ "getDensity", w_Shape_getDensity },
{ "isSensor", w_Shape_isSensor },
{ "testPoint", w_Shape_testPoint },
{ "testSegment", w_Shape_testSegment },
{ "setFilterData", w_Shape_setFilterData },
{ "getFilterData", w_Shape_getFilterData },
{ "setData", w_Shape_setData },
{ "getData", w_Shape_getData },
{ "getBoundingBox", w_Shape_getBoundingBox },
{ 0, 0 }
};
return luax_register_type(L, "CircleShape", functions);
}
} // box2d
+2 -2
View File
@@ -33,8 +33,8 @@ namespace physics
namespace box2d
{
CircleShape * luax_checkcircleshape(lua_State * L, int idx);
int _wrap_CircleShape_getRadius(lua_State * L);
int wrap_CircleShape_open(lua_State * L);
int w_CircleShape_getRadius(lua_State * L);
int luaopen_circleshape(lua_State * L);
} // box2d
} // physics
+19 -20
View File
@@ -29,62 +29,61 @@ namespace box2d
Contact * luax_checkcontact(lua_State * L, int idx)
{
return luax_checktype<Contact>(L, idx, "Contact", LOVE_PHYSICS_CONTACT_BITS);
return luax_checktype<Contact>(L, idx, "Contact", PHYSICS_CONTACT_T);
}
int _wrap_Contact_getPosition(lua_State * L)
int w_Contact_getPosition(lua_State * L)
{
Contact * t = luax_checkcontact(L, 1);
return t->getPosition(L);
}
int _wrap_Contact_getVelocity(lua_State * L)
int w_Contact_getVelocity(lua_State * L)
{
Contact * t = luax_checkcontact(L, 1);
return t->getVelocity(L);
}
int _wrap_Contact_getNormal(lua_State * L)
int w_Contact_getNormal(lua_State * L)
{
Contact * t = luax_checkcontact(L, 1);
return t->getNormal(L);
}
int _wrap_Contact_getSeparation(lua_State * L)
int w_Contact_getSeparation(lua_State * L)
{
Contact * t = luax_checkcontact(L, 1);
lua_pushnumber(L, t->getSeparation());
return 1;
}
int _wrap_Contact_getFriction(lua_State * L)
int w_Contact_getFriction(lua_State * L)
{
Contact * t = luax_checkcontact(L, 1);
lua_pushnumber(L, t->getFriction());
return 1;
}
int _wrap_Contact_getRestitution(lua_State * L)
int w_Contact_getRestitution(lua_State * L)
{
Contact * t = luax_checkcontact(L, 1);
lua_pushnumber(L, t->getRestitution());
return 1;
}
static const luaL_Reg wrap_Contact_functions[] = {
{ "getPosition", _wrap_Contact_getPosition },
{ "getVelocity", _wrap_Contact_getVelocity },
{ "getNormal", _wrap_Contact_getNormal },
{ "getSeparation", _wrap_Contact_getSeparation },
{ "getFriction", _wrap_Contact_getFriction },
{ "getRestitution", _wrap_Contact_getRestitution },
{ 0, 0 }
};
int wrap_Contact_open(lua_State * L)
int luaopen_contact(lua_State * L)
{
luax_register_type(L, "Contact", wrap_Contact_functions);
return 0;
static const luaL_Reg functions[] = {
{ "getPosition", w_Contact_getPosition },
{ "getVelocity", w_Contact_getVelocity },
{ "getNormal", w_Contact_getNormal },
{ "getSeparation", w_Contact_getSeparation },
{ "getFriction", w_Contact_getFriction },
{ "getRestitution", w_Contact_getRestitution },
{ 0, 0 }
};
return luax_register_type(L, "Contact", functions);
}
} // box2d
+7 -7
View File
@@ -32,13 +32,13 @@ namespace physics
namespace box2d
{
Contact * luax_checkcontact(lua_State * L, int idx);
int _wrap_Contact_getPosition(lua_State * L);
int _wrap_Contact_getVelocity(lua_State * L);
int _wrap_Contact_getNormal(lua_State * L);
int _wrap_Contact_getSeparation(lua_State * L);
int _wrap_Contact_getFriction(lua_State * L);
int _wrap_Contact_getRestitution(lua_State * L);
int wrap_Contact_open(lua_State * L);
int w_Contact_getPosition(lua_State * L);
int w_Contact_getVelocity(lua_State * L);
int w_Contact_getNormal(lua_State * L);
int w_Contact_getSeparation(lua_State * L);
int w_Contact_getFriction(lua_State * L);
int w_Contact_getRestitution(lua_State * L);
int luaopen_contact(lua_State * L);
} // box2d
} // physics
@@ -28,10 +28,10 @@ namespace box2d
{
DistanceJoint * luax_checkdistancejoint(lua_State * L, int idx)
{
return luax_checktype<DistanceJoint>(L, idx, "DistanceJoint", LOVE_PHYSICS_DISTANCE_JOINT_BITS);
return luax_checktype<DistanceJoint>(L, idx, "DistanceJoint", PHYSICS_DISTANCE_JOINT_T);
}
int _wrap_DistanceJoint_setLength(lua_State * L)
int w_DistanceJoint_setLength(lua_State * L)
{
DistanceJoint * t = luax_checkdistancejoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -39,14 +39,14 @@ namespace box2d
return 0;
}
int _wrap_DistanceJoint_getLength(lua_State * L)
int w_DistanceJoint_getLength(lua_State * L)
{
DistanceJoint * t = luax_checkdistancejoint(L, 1);
lua_pushnumber(L, t->getLength());
return 1;
}
int _wrap_DistanceJoint_setFrequency(lua_State * L)
int w_DistanceJoint_setFrequency(lua_State * L)
{
DistanceJoint * t = luax_checkdistancejoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -54,14 +54,14 @@ namespace box2d
return 0;
}
int _wrap_DistanceJoint_getFrequency(lua_State * L)
int w_DistanceJoint_getFrequency(lua_State * L)
{
DistanceJoint * t = luax_checkdistancejoint(L, 1);
lua_pushnumber(L, t->getFrequency());
return 1;
}
int _wrap_DistanceJoint_setDampingRatio(lua_State * L)
int w_DistanceJoint_setDampingRatio(lua_State * L)
{
DistanceJoint * t = luax_checkdistancejoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -69,34 +69,33 @@ namespace box2d
return 0;
}
int _wrap_DistanceJoint_getDampingRatio(lua_State * L)
int w_DistanceJoint_getDampingRatio(lua_State * L)
{
DistanceJoint * t = luax_checkdistancejoint(L, 1);
lua_pushnumber(L, t->getDampingRatio());
return 1;
}
static const luaL_Reg wrap_DistanceJoint_functions[] = {
{ "setLength", _wrap_DistanceJoint_setLength },
{ "getLength", _wrap_DistanceJoint_getLength },
{ "setFrequency", _wrap_DistanceJoint_setFrequency },
{ "getFrequency", _wrap_DistanceJoint_getFrequency },
{ "setDamping", _wrap_DistanceJoint_setDampingRatio },
{ "getDamping", _wrap_DistanceJoint_getDampingRatio },
// From Joint.
{ "getType", _wrap_Joint_getType },
{ "getAnchors", _wrap_Joint_getAnchors },
{ "getReactionForce", _wrap_Joint_getReactionForce },
{ "getReactionTorque", _wrap_Joint_getReactionTorque },
{ "setCollideConnected", _wrap_Joint_setCollideConnected },
{ "getCollideConnected", _wrap_Joint_getCollideConnected },
{ 0, 0 }
};
int wrap_DistanceJoint_open(lua_State * L)
int luaopen_distancejoint(lua_State * L)
{
luax_register_type(L, "DistanceJoint", wrap_DistanceJoint_functions);
return 0;
static const luaL_Reg functions[] = {
{ "setLength", w_DistanceJoint_setLength },
{ "getLength", w_DistanceJoint_getLength },
{ "setFrequency", w_DistanceJoint_setFrequency },
{ "getFrequency", w_DistanceJoint_getFrequency },
{ "setDamping", w_DistanceJoint_setDampingRatio },
{ "getDamping", w_DistanceJoint_getDampingRatio },
// From Joint.
{ "getType", w_Joint_getType },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "setCollideConnected", w_Joint_setCollideConnected },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ 0, 0 }
};
return luax_register_type(L, "DistanceJoint", functions);
}
} // box2d
@@ -33,13 +33,13 @@ namespace physics
namespace box2d
{
DistanceJoint * luax_checkdistancejoint(lua_State * L, int idx);
int _wrap_DistanceJoint_setLength(lua_State * L);
int _wrap_DistanceJoint_getLength(lua_State * L);
int _wrap_DistanceJoint_setFrequency(lua_State * L);
int _wrap_DistanceJoint_getFrequency(lua_State * L);
int _wrap_DistanceJoint_setDampingRatio(lua_State * L);
int _wrap_DistanceJoint_getDampingRatio(lua_State * L);
int wrap_DistanceJoint_open(lua_State * L);
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);
int luaopen_distancejoint(lua_State * L);
} // box2d
} // physics
+17 -19
View File
@@ -28,10 +28,10 @@ namespace box2d
{
GearJoint * luax_checkgearjoint(lua_State * L, int idx)
{
return luax_checktype<GearJoint>(L, idx, "GearJoint", LOVE_PHYSICS_GEAR_JOINT_BITS);
return luax_checktype<GearJoint>(L, idx, "GearJoint", PHYSICS_GEAR_JOINT_T);
}
int _wrap_GearJoint_setRatio(lua_State * L)
int w_GearJoint_setRatio(lua_State * L)
{
GearJoint * t = luax_checkgearjoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -39,30 +39,28 @@ namespace box2d
return 0;
}
int _wrap_GearJoint_getRatio(lua_State * L)
int w_GearJoint_getRatio(lua_State * L)
{
GearJoint * t = luax_checkgearjoint(L, 1);
lua_pushnumber(L, t->getRatio());
return 1;
}
static const luaL_Reg wrap_GearJoint_functions[] = {
{ "setRatio", _wrap_GearJoint_setRatio },
{ "getRatio", _wrap_GearJoint_getRatio },
// From Joint.
{ "getType", _wrap_Joint_getType },
{ "getAnchors", _wrap_Joint_getAnchors },
{ "getReactionForce", _wrap_Joint_getReactionForce },
{ "getReactionTorque", _wrap_Joint_getReactionTorque },
{ "setCollideConnected", _wrap_Joint_setCollideConnected },
{ "getCollideConnected", _wrap_Joint_getCollideConnected },
{ 0, 0 }
};
int wrap_GearJoint_open(lua_State * L)
int luaopen_gearjoint(lua_State * L)
{
luax_register_type(L, "GearJoint", wrap_GearJoint_functions);
return 0;
static const luaL_Reg functions[] = {
{ "setRatio", w_GearJoint_setRatio },
{ "getRatio", w_GearJoint_getRatio },
// From Joint.
{ "getType", w_Joint_getType },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "setCollideConnected", w_Joint_setCollideConnected },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ 0, 0 }
};
return luax_register_type(L, "GearJoint", functions);
}
} // box2d
+3 -3
View File
@@ -33,9 +33,9 @@ namespace physics
namespace box2d
{
GearJoint * luax_checkgearjoint(lua_State * L, int idx);
int _wrap_GearJoint_setRatio(lua_State * L);
int _wrap_GearJoint_getRatio(lua_State * L);
int wrap_GearJoint_open(lua_State * L);
int w_GearJoint_setRatio(lua_State * L);
int w_GearJoint_getRatio(lua_State * L);
int luaopen_gearjoint(lua_State * L);
} // box2d
} // physics
+19 -20
View File
@@ -29,38 +29,38 @@ namespace box2d
{
Joint * luax_checkjoint(lua_State * L, int idx)
{
return luax_checktype<Joint>(L, idx, "Joint", LOVE_PHYSICS_JOINT_BITS);
return luax_checktype<Joint>(L, idx, "Joint", PHYSICS_JOINT_T);
}
int _wrap_Joint_getType(lua_State * L)
int w_Joint_getType(lua_State * L)
{
Joint * t = luax_checkjoint(L, 1);
lua_pushinteger(L, t->getType());
return 1;
}
int _wrap_Joint_getAnchors(lua_State * L)
int w_Joint_getAnchors(lua_State * L)
{
Joint * t = luax_checkjoint(L, 1);
lua_remove(L, 1);
return t->getAnchors(L);
}
int _wrap_Joint_getReactionForce(lua_State * L)
int w_Joint_getReactionForce(lua_State * L)
{
Joint * t = luax_checkjoint(L, 1);
lua_remove(L, 1);
return t->getReactionForce(L);
}
int _wrap_Joint_getReactionTorque(lua_State * L)
int w_Joint_getReactionTorque(lua_State * L)
{
Joint * t = luax_checkjoint(L, 1);
lua_pushnumber(L, t->getReactionTorque());
return 1;
}
int _wrap_Joint_setCollideConnected(lua_State * L)
int w_Joint_setCollideConnected(lua_State * L)
{
Joint * t = luax_checkjoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
@@ -68,27 +68,26 @@ namespace box2d
return 0;
}
int _wrap_Joint_getCollideConnected(lua_State * L)
int w_Joint_getCollideConnected(lua_State * L)
{
Joint * t = luax_checkjoint(L, 1);
luax_pushboolean(L, t->getCollideConnected());
return 1;
}
static const luaL_Reg wrap_Joint_functions[] = {
{ "getType", _wrap_Joint_getType },
{ "getAnchors", _wrap_Joint_getAnchors },
{ "getReactionForce", _wrap_Joint_getReactionForce },
{ "getReactionTorque", _wrap_Joint_getReactionTorque },
{ "setCollideConnected", _wrap_Joint_setCollideConnected },
{ "getCollideConnected", _wrap_Joint_getCollideConnected },
{ 0, 0 }
};
int wrap_Joint_open(lua_State * L)
int luaopen_joint(lua_State * L)
{
luax_register_type(L, "Joint", wrap_Joint_functions);
return 0;
static const luaL_Reg functions[] = {
{ "getType", w_Joint_getType },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "setCollideConnected", w_Joint_setCollideConnected },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ 0, 0 }
};
return luax_register_type(L, "Joint", functions);
}
} // box2d
+7 -7
View File
@@ -32,13 +32,13 @@ namespace physics
namespace box2d
{
Joint * luax_checkjoint(lua_State * L, int idx);
int _wrap_Joint_getType(lua_State * L);
int _wrap_Joint_getAnchors(lua_State * L);
int _wrap_Joint_getReactionForce(lua_State * L);
int _wrap_Joint_getReactionTorque(lua_State * L);
int _wrap_Joint_setCollideConnected(lua_State * L);
int _wrap_Joint_getCollideConnected(lua_State * L);
int wrap_Joint_open(lua_State * L);
int w_Joint_getType(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_setCollideConnected(lua_State * L);
int w_Joint_getCollideConnected(lua_State * L);
int luaopen_joint(lua_State * L);
} // box2d
} // physics
+22 -23
View File
@@ -28,10 +28,10 @@ namespace box2d
{
MouseJoint * luax_checkmousejoint(lua_State * L, int idx)
{
return luax_checktype<MouseJoint>(L, idx, "MouseJoint", LOVE_PHYSICS_MOUSE_JOINT_BITS);
return luax_checktype<MouseJoint>(L, idx, "MouseJoint", PHYSICS_MOUSE_JOINT_T);
}
int _wrap_MouseJoint_setTarget(lua_State * L)
int w_MouseJoint_setTarget(lua_State * L)
{
MouseJoint * t = luax_checkmousejoint(L, 1);
float x = (float)luaL_checknumber(L, 2);
@@ -40,14 +40,14 @@ namespace box2d
return 0;
}
int _wrap_MouseJoint_getTarget(lua_State * L)
int w_MouseJoint_getTarget(lua_State * L)
{
MouseJoint * t = luax_checkmousejoint(L, 1);
lua_remove(L, 1);
return t->getTarget(L);
}
int _wrap_MouseJoint_setMaxForce(lua_State * L)
int w_MouseJoint_setMaxForce(lua_State * L)
{
MouseJoint * t = luax_checkmousejoint(L, 1);
float f = (float)luaL_checknumber(L, 2);
@@ -55,32 +55,31 @@ namespace box2d
return 0;
}
int _wrap_MouseJoint_getMaxForce(lua_State * L)
int w_MouseJoint_getMaxForce(lua_State * L)
{
MouseJoint * t = luax_checkmousejoint(L, 1);
lua_pushnumber(L, t->getMaxForce());
return 1;
}
static const luaL_Reg wrap_MouseJoint_functions[] = {
{ "setTarget", _wrap_MouseJoint_setTarget },
{ "getTarget", _wrap_MouseJoint_getTarget },
{ "setMaxForce", _wrap_MouseJoint_setMaxForce },
{ "getMaxForce", _wrap_MouseJoint_getMaxForce },
// From Joint.
{ "getType", _wrap_Joint_getType },
{ "getAnchors", _wrap_Joint_getAnchors },
{ "getReactionForce", _wrap_Joint_getReactionForce },
{ "getReactionTorque", _wrap_Joint_getReactionTorque },
{ "setCollideConnected", _wrap_Joint_setCollideConnected },
{ "getCollideConnected", _wrap_Joint_getCollideConnected },
{ 0, 0 }
};
int wrap_MouseJoint_open(lua_State * L)
int luaopen_mousejoint(lua_State * L)
{
luax_register_type(L, "MouseJoint", wrap_MouseJoint_functions);
return 0;
static const luaL_Reg functions[] = {
{ "setTarget", w_MouseJoint_setTarget },
{ "getTarget", w_MouseJoint_getTarget },
{ "setMaxForce", w_MouseJoint_setMaxForce },
{ "getMaxForce", w_MouseJoint_getMaxForce },
// From Joint.
{ "getType", w_Joint_getType },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "setCollideConnected", w_Joint_setCollideConnected },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ 0, 0 }
};
return luax_register_type(L, "MouseJoint", functions);
}
} // box2d
+5 -5
View File
@@ -33,11 +33,11 @@ namespace physics
namespace box2d
{
MouseJoint * luax_checkmousejoint(lua_State * L, int idx);
int _wrap_MouseJoint_setTarget(lua_State * L);
int _wrap_MouseJoint_getTarget(lua_State * L);
int _wrap_MouseJoint_setMaxForce(lua_State * L);
int _wrap_MouseJoint_getMaxForce(lua_State * L);
int wrap_MouseJoint_open(lua_State * L);
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 luaopen_mousejoint(lua_State * L);
} // box2d
} // physics
+87 -94
View File
@@ -29,14 +29,14 @@ namespace box2d
{
static Physics * instance = 0;
int _wrap_newWorld(lua_State * L)
int w_newWorld(lua_State * L)
{
if(lua_gettop(L) == 2)
{
float x = (float)luaL_checknumber(L, 1);
float y = (float)luaL_checknumber(L, 2);
World * w = instance->newWorld(x, y);
luax_newtype(L, "World", LOVE_PHYSICS_WORLD_BITS, (void*)w);
luax_newtype(L, "World", PHYSICS_WORLD_T, (void*)w);
return 1;
}
else if(lua_gettop(L) == 6)
@@ -49,35 +49,35 @@ namespace box2d
float gy = (float)luaL_checknumber(L, 6);
bool sleep = luax_toboolean(L, 7);
World * w = instance->newWorld(lx, ly, ux, uy, gx, gy, sleep);
luax_newtype(L, "World", LOVE_PHYSICS_WORLD_BITS, (void*)w);
luax_newtype(L, "World", PHYSICS_WORLD_T, (void*)w);
return 1;
}
else
return luaL_error(L, "Incorrect number of parameters");
}
int _wrap_newBody(lua_State * L)
int w_newBody(lua_State * L)
{
World * world = luax_checktype<World>(L, 1, "World", LOVE_PHYSICS_WORLD_BITS);
World * world = luax_checktype<World>(L, 1, "World", PHYSICS_WORLD_T);
float x = (float)luaL_optnumber(L, 2, 0.0);
float y = (float)luaL_optnumber(L, 3, 0.0);
float m = (float)luaL_optnumber(L, 4, 1.0);
float i = (float)luaL_optnumber(L, 5, 1.0);
Body * body = instance->newBody(world, x, y, m, i);
luax_newtype(L, "Body", LOVE_PHYSICS_BODY_BITS, (void*)body);
luax_newtype(L, "Body", PHYSICS_BODY_T, (void*)body);
return 1;
}
int _wrap_newCircleShape(lua_State * L)
int w_newCircleShape(lua_State * L)
{
Body * body = luax_checktype<Body>(L, 1, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
int top = lua_gettop(L);
if(top == 2)
{
float radius = (float)luaL_checknumber(L, 2);
CircleShape * shape = instance->newCircleShape(body, radius);
luax_newtype(L, "CircleShape", LOVE_PHYSICS_CIRCLE_SHAPE_BITS, (void*)shape);
luax_newtype(L, "CircleShape", PHYSICS_CIRCLE_SHAPE_T, (void*)shape);
return 1;
}
else if(top == 4)
@@ -86,16 +86,16 @@ namespace box2d
float y = (float)luaL_checknumber(L, 3);
float radius = (float)luaL_checknumber(L, 4);
CircleShape * shape = instance->newCircleShape(body, x, y, radius);
luax_newtype(L, "CircleShape", LOVE_PHYSICS_CIRCLE_SHAPE_BITS, (void*)shape);
luax_newtype(L, "CircleShape", PHYSICS_CIRCLE_SHAPE_T, (void*)shape);
return 1;
}
else
return luaL_error(L, "Incorrect number of parameters");
}
int _wrap_newRectangleShape(lua_State * L)
int w_newRectangleShape(lua_State * L)
{
Body * body = luax_checktype<Body>(L, 1, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
int top = lua_gettop(L);
if(top == 3)
@@ -103,7 +103,7 @@ namespace box2d
float w = (float)luaL_checknumber(L, 2);
float h = (float)luaL_checknumber(L, 3);
PolygonShape * shape = instance->newRectangleShape(body, w, h);
luax_newtype(L, "PolygonShape", LOVE_PHYSICS_POLYGON_SHAPE_BITS, (void*)shape);
luax_newtype(L, "PolygonShape", PHYSICS_POLYGON_SHAPE_T, (void*)shape);
return 1;
}
else if(top == 5 || top == 6)
@@ -114,69 +114,69 @@ namespace box2d
float h = (float)luaL_checknumber(L, 5);
float angle = (float)luaL_optnumber(L, 6, 0);
PolygonShape * shape = instance->newRectangleShape(body, x, y, w, h, angle);
luax_newtype(L, "PolygonShape", LOVE_PHYSICS_POLYGON_SHAPE_BITS, (void*)shape);
luax_newtype(L, "PolygonShape", PHYSICS_POLYGON_SHAPE_T, (void*)shape);
return 1;
}
else
return luaL_error(L, "Incorrect number of parameters");
}
int _wrap_newPolygonShape(lua_State * L)
int w_newPolygonShape(lua_State * L)
{
return instance->newPolygonShape(L);
}
int _wrap_newDistanceJoint(lua_State * L)
int w_newDistanceJoint(lua_State * L)
{
Body * body1 = luax_checktype<Body>(L, 1, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body2 = luax_checktype<Body>(L, 2, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body1 = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
Body * body2 = luax_checktype<Body>(L, 2, "Body", PHYSICS_BODY_T);
float x1 = (float)luaL_checknumber(L, 3);
float y1 = (float)luaL_checknumber(L, 4);
float x2 = (float)luaL_checknumber(L, 5);
float y2 = (float)luaL_checknumber(L, 6);
DistanceJoint * j = instance->newDistanceJoint(body1, body2, x1, y1, x2, y2);
luax_newtype(L, "DistanceJoint", LOVE_PHYSICS_DISTANCE_JOINT_BITS, (void*)j);
luax_newtype(L, "DistanceJoint", PHYSICS_DISTANCE_JOINT_T, (void*)j);
return 1;
}
int _wrap_newMouseJoint(lua_State * L)
int w_newMouseJoint(lua_State * L)
{
Body * body = luax_checktype<Body>(L, 1, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
float x = (float)luaL_checknumber(L, 2);
float y = (float)luaL_checknumber(L, 3);
MouseJoint * j = instance->newMouseJoint(body, x, y);
luax_newtype(L, "MouseJoint", LOVE_PHYSICS_MOUSE_JOINT_BITS, (void*)j);
luax_newtype(L, "MouseJoint", PHYSICS_MOUSE_JOINT_T, (void*)j);
return 1;
}
int _wrap_newRevoluteJoint(lua_State * L)
int w_newRevoluteJoint(lua_State * L)
{
Body * body1 = luax_checktype<Body>(L, 1, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body2 = luax_checktype<Body>(L, 2, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body1 = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
Body * body2 = luax_checktype<Body>(L, 2, "Body", PHYSICS_BODY_T);
float x = (float)luaL_checknumber(L, 3);
float y = (float)luaL_checknumber(L, 4);
RevoluteJoint * j = instance->newRevoluteJoint(body1, body2, x, y);
luax_newtype(L, "RevoluteJoint", LOVE_PHYSICS_REVOLUTE_JOINT_BITS, (void*)j);
luax_newtype(L, "RevoluteJoint", PHYSICS_REVOLUTE_JOINT_T, (void*)j);
return 1;
}
int _wrap_newPrismaticJoint(lua_State * L)
int w_newPrismaticJoint(lua_State * L)
{
Body * body1 = luax_checktype<Body>(L, 1, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body2 = luax_checktype<Body>(L, 2, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body1 = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
Body * body2 = luax_checktype<Body>(L, 2, "Body", PHYSICS_BODY_T);
float x = (float)luaL_checknumber(L, 3);
float y = (float)luaL_checknumber(L, 4);
float ax = (float)luaL_checknumber(L, 5);
float ay = (float)luaL_checknumber(L, 6);
PrismaticJoint * j = instance->newPrismaticJoint(body1, body2, x, y, ax, ay);
luax_newtype(L, "PrismaticJoint", LOVE_PHYSICS_PRISMATIC_JOINT_BITS, (void*)j);
luax_newtype(L, "PrismaticJoint", PHYSICS_PRISMATIC_JOINT_T, (void*)j);
return 1;
}
int _wrap_newPulleyJoint(lua_State * L)
int w_newPulleyJoint(lua_State * L)
{
Body * body1 = luax_checktype<Body>(L, 1, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body2 = luax_checktype<Body>(L, 2, "Body", LOVE_PHYSICS_BODY_BITS);
Body * body1 = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
Body * body2 = luax_checktype<Body>(L, 2, "Body", PHYSICS_BODY_T);
float gx1 = (float)luaL_checknumber(L, 3);
float gy1 = (float)luaL_checknumber(L, 4);
float gx2 = (float)luaL_checknumber(L, 5);
@@ -188,72 +188,70 @@ namespace box2d
float ratio = (float)luaL_optnumber(L, 11, 1.0);
PulleyJoint * j = instance->newPulleyJoint(body1, body2, b2Vec2(gx1,gy1), b2Vec2(gx2,gy2), b2Vec2(x1,y1), b2Vec2(x2,y2), ratio);
luax_newtype(L, "PulleyJoint", LOVE_PHYSICS_PULLEY_JOINT_BITS, (void*)j);
luax_newtype(L, "PulleyJoint", PHYSICS_PULLEY_JOINT_T, (void*)j);
return 1;
}
int _wrap_newGearJoint(lua_State * L)
int w_newGearJoint(lua_State * L)
{
Joint * joint1 = luax_checktype<Joint>(L, 1, "Joint", LOVE_PHYSICS_JOINT_BITS);
Joint * joint2 = luax_checktype<Joint>(L, 2, "Joint", LOVE_PHYSICS_JOINT_BITS);
Joint * joint1 = luax_checktype<Joint>(L, 1, "Joint", PHYSICS_JOINT_T);
Joint * joint2 = luax_checktype<Joint>(L, 2, "Joint", PHYSICS_JOINT_T);
float ratio = (float)luaL_optnumber(L, 3, 1.0);
GearJoint * j = instance->newGearJoint(joint1, joint2, ratio);
luax_newtype(L, "GearJoint", LOVE_PHYSICS_GEAR_JOINT_BITS, (void*)j);
luax_newtype(L, "GearJoint", PHYSICS_GEAR_JOINT_T, (void*)j);
return 1;
}
// List of functions to wrap.
static const luaL_Reg wrap_Physics_functions[] = {
{ "newWorld", _wrap_newWorld },
{ "newBody", _wrap_newBody },
{ "newCircleShape", _wrap_newCircleShape },
{ "newRectangleShape", _wrap_newRectangleShape },
{ "newPolygonShape", _wrap_newPolygonShape },
{ "newDistanceJoint", _wrap_newDistanceJoint },
{ "newMouseJoint", _wrap_newMouseJoint },
{ "newRevoluteJoint", _wrap_newRevoluteJoint },
{ "newPrismaticJoint", _wrap_newPrismaticJoint },
{ "newPulleyJoint", _wrap_newPulleyJoint },
{ "newGearJoint", _wrap_newGearJoint },
{ 0, 0 },
};
static const lua_CFunction wrap_Physics_types[] = {
wrap_World_open,
wrap_Contact_open,
wrap_Body_open,
wrap_Shape_open,
wrap_CircleShape_open,
wrap_PolygonShape_open,
wrap_Joint_open,
wrap_MouseJoint_open,
wrap_DistanceJoint_open,
wrap_PrismaticJoint_open,
wrap_RevoluteJoint_open,
wrap_PulleyJoint_open,
wrap_GearJoint_open,
0
};
// List of constants.
static const LuaConstant wrap_Physics_constants[] = {
{ "shape_circle", Shape::SHAPE_CIRCLE },
{ "shape_polygon", Shape::SHAPE_POLYGON },
{ "joint_distance", Joint::JOINT_DISTANCE },
{ "joint_revolute", Joint::JOINT_REVOLUTE },
{ "joint_prismatic", Joint::JOINT_PRISMATIC },
{ "joint_mouse", Joint::JOINT_MOUSE },
{ "joint_pulley", Joint::JOINT_PULLEY },
{ "joint_gear", Joint::JOINT_GEAR },
{ 0, 0 }
};
int wrap_Physics_open(lua_State * L)
int luaopen_love_physics(lua_State * L)
{
// List of functions to wrap.
static const luaL_Reg functions[] = {
{ "newWorld", w_newWorld },
{ "newBody", w_newBody },
{ "newCircleShape", w_newCircleShape },
{ "newRectangleShape", w_newRectangleShape },
{ "newPolygonShape", w_newPolygonShape },
{ "newDistanceJoint", w_newDistanceJoint },
{ "newMouseJoint", w_newMouseJoint },
{ "newRevoluteJoint", w_newRevoluteJoint },
{ "newPrismaticJoint", w_newPrismaticJoint },
{ "newPulleyJoint", w_newPulleyJoint },
{ "newGearJoint", w_newGearJoint },
{ 0, 0 },
};
static const lua_CFunction types[] = {
luaopen_world,
luaopen_contact,
luaopen_body,
luaopen_shape,
luaopen_circleshape,
luaopen_polygonshape,
luaopen_joint,
luaopen_mousejoint,
luaopen_distancejoint,
luaopen_prismaticjoint,
luaopen_revolutejoint,
luaopen_pulleyjoint,
luaopen_gearjoint,
0
};
// List of constants.
static const LuaConstant constants[] = {
{ "shape_circle", Shape::SHAPE_CIRCLE },
{ "shape_polygon", Shape::SHAPE_POLYGON },
{ "joint_distance", Joint::JOINT_DISTANCE },
{ "joint_revolute", Joint::JOINT_REVOLUTE },
{ "joint_prismatic", Joint::JOINT_PRISMATIC },
{ "joint_mouse", Joint::JOINT_MOUSE },
{ "joint_pulley", Joint::JOINT_PULLEY },
{ "joint_gear", Joint::JOINT_GEAR },
{ 0, 0 }
};
if(instance == 0)
{
try
@@ -266,14 +264,9 @@ namespace box2d
}
}
return luax_register_module(L, wrap_Physics_functions, wrap_Physics_types, wrap_Physics_constants, "physics");
return luax_register_module(L, functions, types, constants, "physics");
}
} // box2d
} // physics
} // love
int luaopen_love_physics(lua_State * L)
{
return love::physics::box2d::wrap_Physics_open(L);
}
+12 -14
View File
@@ -44,23 +44,21 @@ namespace physics
{
namespace box2d
{
int _wrap_newWorld(lua_State * L);
int _wrap_newBody(lua_State * L);
int _wrap_newCircleShape(lua_State * L);
int _wrap_newRectangleShape(lua_State * L);
int _wrap_newPolygonShape(lua_State * L);;
int _wrap_newDistanceJoint(lua_State * L);
int _wrap_newMouseJoint(lua_State * L);
int _wrap_newRevoluteJoint(lua_State * L);
int _wrap_newPrismaticJoint(lua_State * L);
int _wrap_newPulleyJoint(lua_State * L);
int _wrap_newGearJoint(lua_State * L);
int wrap_Physics_open(lua_State * L);
int w_newWorld(lua_State * L);
int w_newBody(lua_State * L);
int w_newCircleShape(lua_State * L);
int w_newRectangleShape(lua_State * L);
int w_newPolygonShape(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);
extern "C" LOVE_EXPORT int luaopen_love_physics(lua_State * L);
} // box2d
} // physics
} // love
extern "C" LOVE_EXPORT int luaopen_love_physics(lua_State * L);
#endif // LOVE_PHYSICS_BOX2D_WRAP_PHYSICS_H
+25 -27
View File
@@ -28,42 +28,40 @@ namespace box2d
{
PolygonShape * luax_checkpolygonshape(lua_State * L, int idx)
{
return luax_checktype<PolygonShape>(L, idx, "PolygonShape", LOVE_PHYSICS_POLYGON_SHAPE_BITS);
return luax_checktype<PolygonShape>(L, idx, "PolygonShape", PHYSICS_POLYGON_SHAPE_T);
}
int _wrap_PolygonShape_getPoints(lua_State * L)
int w_PolygonShape_getPoints(lua_State * L)
{
PolygonShape * t = luax_checkpolygonshape(L, 1);
lua_remove(L, 1);
return t->getPoints(L);
}
static const luaL_Reg wrap_PolygonShape_functions[] = {
{ "getPoints", _wrap_PolygonShape_getPoints },
// From Shape.
{ "getType", _wrap_Shape_getType },
{ "setFriction", _wrap_Shape_setFriction },
{ "setRestitution", _wrap_Shape_setRestitution },
{ "setDensity", _wrap_Shape_setDensity },
{ "setSensor", _wrap_Shape_setSensor },
{ "getFriction", _wrap_Shape_getFriction },
{ "getRestituion", _wrap_Shape_getRestituion },
{ "getDensity", _wrap_Shape_getDensity },
{ "isSensor", _wrap_Shape_isSensor },
{ "testPoint", _wrap_Shape_testPoint },
{ "testSegment", _wrap_Shape_testSegment },
{ "setFilterData", _wrap_Shape_setFilterData },
{ "getFilterData", _wrap_Shape_getFilterData },
{ "setData", _wrap_Shape_setData },
{ "getData", _wrap_Shape_getData },
{ "getBoundingBox", _wrap_Shape_getBoundingBox },
{ 0, 0 }
};
int wrap_PolygonShape_open(lua_State * L)
int luaopen_polygonshape(lua_State * L)
{
luax_register_type(L, "PolygonShape", wrap_PolygonShape_functions);
return 0;
static const luaL_Reg functions[] = {
{ "getPoints", w_PolygonShape_getPoints },
// From Shape.
{ "getType", w_Shape_getType },
{ "setFriction", w_Shape_setFriction },
{ "setRestitution", w_Shape_setRestitution },
{ "setDensity", w_Shape_setDensity },
{ "setSensor", w_Shape_setSensor },
{ "getFriction", w_Shape_getFriction },
{ "getRestituion", w_Shape_getRestituion },
{ "getDensity", w_Shape_getDensity },
{ "isSensor", w_Shape_isSensor },
{ "testPoint", w_Shape_testPoint },
{ "testSegment", w_Shape_testSegment },
{ "setFilterData", w_Shape_setFilterData },
{ "getFilterData", w_Shape_getFilterData },
{ "setData", w_Shape_setData },
{ "getData", w_Shape_getData },
{ "getBoundingBox", w_Shape_getBoundingBox },
{ 0, 0 }
};
return luax_register_type(L, "PolygonShape", functions);
}
} // box2d
@@ -33,8 +33,8 @@ namespace physics
namespace box2d
{
PolygonShape * luax_checkpolygonshape(lua_State * L, int idx);
int _wrap_PolygonShape_getPoints(lua_State * L);
int wrap_PolygonShape_open(lua_State * L);
int w_PolygonShape_getPoints(lua_State * L);
int luaopen_polygonshape(lua_State * L);
} // box2d
} // physics
@@ -28,24 +28,24 @@ namespace box2d
{
PrismaticJoint * luax_checkprismaticjoint(lua_State * L, int idx)
{
return luax_checktype<PrismaticJoint>(L, idx, "PrismaticJoint", LOVE_PHYSICS_PRISMATIC_JOINT_BITS);
return luax_checktype<PrismaticJoint>(L, idx, "PrismaticJoint", PHYSICS_PRISMATIC_JOINT_T);
}
int _wrap_PrismaticJoint_getJointTranslation(lua_State * L)
int w_PrismaticJoint_getJointTranslation(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_pushnumber(L, t->getJointTranslation());
return 1;
}
int _wrap_PrismaticJoint_getJointSpeed(lua_State * L)
int w_PrismaticJoint_getJointSpeed(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_pushnumber(L, t->getJointSpeed());
return 1;
}
int _wrap_PrismaticJoint_setMotorEnabled(lua_State * L)
int w_PrismaticJoint_setMotorEnabled(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
@@ -53,14 +53,14 @@ namespace box2d
return 0;
}
int _wrap_PrismaticJoint_isMotorEnabled(lua_State * L)
int w_PrismaticJoint_isMotorEnabled(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
luax_pushboolean(L, t->isMotorEnabled());
return 1;
}
int _wrap_PrismaticJoint_setMaxMotorForce(lua_State * L)
int w_PrismaticJoint_setMaxMotorForce(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -68,14 +68,14 @@ namespace box2d
return 0;
}
int _wrap_PrismaticJoint_getMaxMotorForce(lua_State * L)
int w_PrismaticJoint_getMaxMotorForce(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_pushnumber(L, t->getMaxMotorForce());
return 1;
}
int _wrap_PrismaticJoint_setMotorSpeed(lua_State * L)
int w_PrismaticJoint_setMotorSpeed(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -83,21 +83,21 @@ namespace box2d
return 0;
}
int _wrap_PrismaticJoint_getMotorSpeed(lua_State * L)
int w_PrismaticJoint_getMotorSpeed(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_pushnumber(L, t->getMotorSpeed());
return 1;
}
int _wrap_PrismaticJoint_getMotorForce(lua_State * L)
int w_PrismaticJoint_getMotorForce(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_pushnumber(L, t->getMotorForce());
return 1;
}
int _wrap_PrismaticJoint_setLimitsEnabled(lua_State * L)
int w_PrismaticJoint_setLimitsEnabled(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
@@ -105,14 +105,14 @@ namespace box2d
return 0;
}
int _wrap_PrismaticJoint_isLimitsEnabled(lua_State * L)
int w_PrismaticJoint_isLimitsEnabled(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
luax_pushboolean(L, t->isLimitsEnabled());
return 1;
}
int _wrap_PrismaticJoint_setUpperLimit(lua_State * L)
int w_PrismaticJoint_setUpperLimit(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -120,7 +120,7 @@ namespace box2d
return 0;
}
int _wrap_PrismaticJoint_setLowerLimit(lua_State * L)
int w_PrismaticJoint_setLowerLimit(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -128,7 +128,7 @@ namespace box2d
return 0;
}
int _wrap_PrismaticJoint_setLimits(lua_State * L)
int w_PrismaticJoint_setLimits(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -137,59 +137,58 @@ namespace box2d
return 0;
}
int _wrap_PrismaticJoint_getLowerLimit(lua_State * L)
int w_PrismaticJoint_getLowerLimit(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_pushnumber(L, t->getLowerLimit());
return 1;
}
int _wrap_PrismaticJoint_getUpperLimit(lua_State * L)
int w_PrismaticJoint_getUpperLimit(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_pushnumber(L, t->getUpperLimit());
return 1;
}
int _wrap_PrismaticJoint_getLimits(lua_State * L)
int w_PrismaticJoint_getLimits(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_remove(L, 1);
return t->getLimits(L);
}
static const luaL_Reg wrap_PrismaticJoint_functions[] = {
{ "getJointTranslation", _wrap_PrismaticJoint_getJointTranslation },
{ "getJointSpeed", _wrap_PrismaticJoint_getJointSpeed },
{ "setMotorEnabled", _wrap_PrismaticJoint_setMotorEnabled },
{ "isMotorEnabled", _wrap_PrismaticJoint_isMotorEnabled },
{ "setMaxMotorForce", _wrap_PrismaticJoint_setMaxMotorForce },
{ "getMaxMotorForce", _wrap_PrismaticJoint_getMaxMotorForce },
{ "setMotorSpeed", _wrap_PrismaticJoint_setMotorSpeed },
{ "getMotorSpeed", _wrap_PrismaticJoint_getMotorSpeed },
{ "getMotorForce", _wrap_PrismaticJoint_getMotorForce },
{ "setLimitsEnabled", _wrap_PrismaticJoint_setLimitsEnabled },
{ "isLimitsEnabled", _wrap_PrismaticJoint_isLimitsEnabled },
{ "setUpperLimit", _wrap_PrismaticJoint_setUpperLimit },
{ "setLowerLimit", _wrap_PrismaticJoint_setLowerLimit },
{ "setLimits", _wrap_PrismaticJoint_setLimits },
{ "getLowerLimit", _wrap_PrismaticJoint_getLowerLimit },
{ "getUpperLimit", _wrap_PrismaticJoint_getUpperLimit },
{ "getLimits", _wrap_PrismaticJoint_getLimits },
// From Joint.
{ "getType", _wrap_Joint_getType },
{ "getAnchors", _wrap_Joint_getAnchors },
{ "getReactionForce", _wrap_Joint_getReactionForce },
{ "getReactionTorque", _wrap_Joint_getReactionTorque },
{ "setCollideConnected", _wrap_Joint_setCollideConnected },
{ "getCollideConnected", _wrap_Joint_getCollideConnected },
{ 0, 0 }
};
int wrap_PrismaticJoint_open(lua_State * L)
int w_PrismaticJoint_open(lua_State * L)
{
luax_register_type(L, "PrismaticJoint", wrap_PrismaticJoint_functions);
return 0;
static const luaL_Reg functions[] = {
{ "getJointTranslation", w_PrismaticJoint_getJointTranslation },
{ "getJointSpeed", w_PrismaticJoint_getJointSpeed },
{ "setMotorEnabled", w_PrismaticJoint_setMotorEnabled },
{ "isMotorEnabled", w_PrismaticJoint_isMotorEnabled },
{ "setMaxMotorForce", w_PrismaticJoint_setMaxMotorForce },
{ "getMaxMotorForce", w_PrismaticJoint_getMaxMotorForce },
{ "setMotorSpeed", w_PrismaticJoint_setMotorSpeed },
{ "getMotorSpeed", w_PrismaticJoint_getMotorSpeed },
{ "getMotorForce", w_PrismaticJoint_getMotorForce },
{ "setLimitsEnabled", w_PrismaticJoint_setLimitsEnabled },
{ "isLimitsEnabled", w_PrismaticJoint_isLimitsEnabled },
{ "setUpperLimit", w_PrismaticJoint_setUpperLimit },
{ "setLowerLimit", w_PrismaticJoint_setLowerLimit },
{ "setLimits", w_PrismaticJoint_setLimits },
{ "getLowerLimit", w_PrismaticJoint_getLowerLimit },
{ "getUpperLimit", w_PrismaticJoint_getUpperLimit },
{ "getLimits", w_PrismaticJoint_getLimits },
// From Joint.
{ "getType", w_Joint_getType },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "setCollideConnected", w_Joint_setCollideConnected },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ 0, 0 }
};
return luax_register_type(L, "PrismaticJoint", functions);
}
} // box2d
+18 -18
View File
@@ -33,24 +33,24 @@ namespace physics
namespace box2d
{
PrismaticJoint * luax_checkprismaticjoint(lua_State * L, int idx);
int _wrap_PrismaticJoint_getJointTranslation(lua_State * L);
int _wrap_PrismaticJoint_getJointSpeed(lua_State * L);
int _wrap_PrismaticJoint_setMotorEnabled(lua_State * L);
int _wrap_PrismaticJoint_isMotorEnabled(lua_State * L);
int _wrap_PrismaticJoint_setMaxMotorForce(lua_State * L);
int _wrap_PrismaticJoint_getMaxMotorForce(lua_State * L);
int _wrap_PrismaticJoint_setMotorSpeed(lua_State * L);
int _wrap_PrismaticJoint_getMotorSpeed(lua_State * L);
int _wrap_PrismaticJoint_getMotorForce(lua_State * L);
int _wrap_PrismaticJoint_setLimitsEnabled(lua_State * L);
int _wrap_PrismaticJoint_isLimitsEnabled(lua_State * L);
int _wrap_PrismaticJoint_setUpperLimit(lua_State * L);
int _wrap_PrismaticJoint_setLowerLimit(lua_State * L);
int _wrap_PrismaticJoint_setLimits(lua_State * L);
int _wrap_PrismaticJoint_getLowerLimit(lua_State * L);
int _wrap_PrismaticJoint_getUpperLimit(lua_State * L);
int _wrap_PrismaticJoint_getLimits(lua_State * L);
int wrap_PrismaticJoint_open(lua_State * L);
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_getMaxMotorForce(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_setLimitsEnabled(lua_State * L);
int w_PrismaticJoint_isLimitsEnabled(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);
int luaopen_prismaticjoint(lua_State * L);
} // box2d
} // physics
+31 -33
View File
@@ -28,17 +28,17 @@ namespace box2d
{
PulleyJoint * luax_checkpulleyjoint(lua_State * L, int idx)
{
return luax_checktype<PulleyJoint>(L, idx, "PulleyJoint", LOVE_PHYSICS_PULLEY_JOINT_BITS);
return luax_checktype<PulleyJoint>(L, idx, "PulleyJoint", PHYSICS_PULLEY_JOINT_T);
}
int _wrap_PulleyJoint_getGroundAnchors(lua_State * L)
int w_PulleyJoint_getGroundAnchors(lua_State * L)
{
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
lua_remove(L, 1);
return t->getGroundAnchors(L);
}
int _wrap_PulleyJoint_setMaxLengths(lua_State * L)
int w_PulleyJoint_setMaxLengths(lua_State * L)
{
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
float arg1 = (float)luaL_optnumber(L, 2, 0.0);
@@ -47,14 +47,14 @@ namespace box2d
return 0;
}
int _wrap_PulleyJoint_getMaxLengths(lua_State * L)
int w_PulleyJoint_getMaxLengths(lua_State * L)
{
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
lua_remove(L, 1);
return t->getMaxLengths(L);
}
int _wrap_PulleyJoint_setConstant(lua_State * L)
int w_PulleyJoint_setConstant(lua_State * L)
{
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -62,28 +62,28 @@ namespace box2d
return 0;
}
int _wrap_PulleyJoint_getConstant(lua_State * L)
int w_PulleyJoint_getConstant(lua_State * L)
{
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
lua_pushnumber(L, t->getConstant());
return 1;
}
int _wrap_PulleyJoint_getLength1(lua_State * L)
int w_PulleyJoint_getLength1(lua_State * L)
{
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
lua_pushnumber(L, t->getLength1());
return 1;
}
int _wrap_PulleyJoint_getLength2(lua_State * L)
int w_PulleyJoint_getLength2(lua_State * L)
{
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
lua_pushnumber(L, t->getLength2());
return 1;
}
int _wrap_PulleyJoint_setRatio(lua_State * L)
int w_PulleyJoint_setRatio(lua_State * L)
{
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -91,37 +91,35 @@ namespace box2d
return 0;
}
int _wrap_PulleyJoint_getRatio(lua_State * L)
int w_PulleyJoint_getRatio(lua_State * L)
{
PulleyJoint * t = luax_checkpulleyjoint(L, 1);
lua_pushnumber(L, t->getRatio());
return 1;
}
static const luaL_Reg wrap_PulleyJoint_functions[] = {
{ "getGroundAnchors", _wrap_PulleyJoint_getGroundAnchors },
{ "setMaxLengths", _wrap_PulleyJoint_setMaxLengths },
{ "getMaxLengths", _wrap_PulleyJoint_getMaxLengths },
{ "setConstant", _wrap_PulleyJoint_setConstant },
{ "getConstant", _wrap_PulleyJoint_getConstant },
{ "getLength1", _wrap_PulleyJoint_getLength1 },
{ "getLength2", _wrap_PulleyJoint_getLength2 },
{ "setRatio", _wrap_PulleyJoint_setRatio },
{ "getRatio", _wrap_PulleyJoint_getRatio },
// From Joint.
{ "getType", _wrap_Joint_getType },
{ "getAnchors", _wrap_Joint_getAnchors },
{ "getReactionForce", _wrap_Joint_getReactionForce },
{ "getReactionTorque", _wrap_Joint_getReactionTorque },
{ "setCollideConnected", _wrap_Joint_setCollideConnected },
{ "getCollideConnected", _wrap_Joint_getCollideConnected },
{ 0, 0 }
};
int wrap_PulleyJoint_open(lua_State * L)
int luaopen_pulleyjoint(lua_State * L)
{
luax_register_type(L, "PulleyJoint", wrap_PulleyJoint_functions);
return 0;
static const luaL_Reg functions[] = {
{ "getGroundAnchors", w_PulleyJoint_getGroundAnchors },
{ "setMaxLengths", w_PulleyJoint_setMaxLengths },
{ "getMaxLengths", w_PulleyJoint_getMaxLengths },
{ "setConstant", w_PulleyJoint_setConstant },
{ "getConstant", w_PulleyJoint_getConstant },
{ "getLength1", w_PulleyJoint_getLength1 },
{ "getLength2", w_PulleyJoint_getLength2 },
{ "setRatio", w_PulleyJoint_setRatio },
{ "getRatio", w_PulleyJoint_getRatio },
// From Joint.
{ "getType", w_Joint_getType },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "setCollideConnected", w_Joint_setCollideConnected },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ 0, 0 }
};
return luax_register_type(L, "PulleyJoint", functions);
}
} // box2d
+10 -10
View File
@@ -33,16 +33,16 @@ namespace physics
namespace box2d
{
PulleyJoint * luax_checkpulleyjoint(lua_State * L, int idx);
int _wrap_PulleyJoint_getGroundAnchors(lua_State * L);
int _wrap_PulleyJoint_setMaxLengths(lua_State * L);
int _wrap_PulleyJoint_getMaxLengths(lua_State * L);
int _wrap_PulleyJoint_setConstant(lua_State * L);
int _wrap_PulleyJoint_getConstant(lua_State * L);
int _wrap_PulleyJoint_getLength1(lua_State * L);
int _wrap_PulleyJoint_getLength2(lua_State * L);
int _wrap_PulleyJoint_setRatio(lua_State * L);
int _wrap_PulleyJoint_getRatio(lua_State * L);
int wrap_PulleyJoint_open(lua_State * L);
int w_PulleyJoint_getGroundAnchors(lua_State * L);
int w_PulleyJoint_setMaxLengths(lua_State * L);
int w_PulleyJoint_getMaxLengths(lua_State * L);
int w_PulleyJoint_setConstant(lua_State * L);
int w_PulleyJoint_getConstant(lua_State * L);
int w_PulleyJoint_getLength1(lua_State * L);
int w_PulleyJoint_getLength2(lua_State * L);
int w_PulleyJoint_setRatio(lua_State * L);
int w_PulleyJoint_getRatio(lua_State * L);
int luaopen_pulleyjoint(lua_State * L);
} // box2d
} // physics
@@ -28,24 +28,24 @@ namespace box2d
{
RevoluteJoint * luax_checkrevolutejoint(lua_State * L, int idx)
{
return luax_checktype<RevoluteJoint>(L, idx, "RevoluteJoint", LOVE_PHYSICS_REVOLUTE_JOINT_BITS);
return luax_checktype<RevoluteJoint>(L, idx, "RevoluteJoint", PHYSICS_REVOLUTE_JOINT_T);
}
int _wrap_RevoluteJoint_getJointAngle(lua_State * L)
int w_RevoluteJoint_getJointAngle(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_pushnumber(L, t->getJointAngle());
return 1;
}
int _wrap_RevoluteJoint_getJointSpeed(lua_State * L)
int w_RevoluteJoint_getJointSpeed(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_pushnumber(L, t->getJointSpeed());
return 1;
}
int _wrap_RevoluteJoint_setMotorEnabled(lua_State * L)
int w_RevoluteJoint_setMotorEnabled(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
@@ -53,14 +53,14 @@ namespace box2d
return 0;
}
int _wrap_RevoluteJoint_isMotorEnabled(lua_State * L)
int w_RevoluteJoint_isMotorEnabled(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
luax_pushboolean(L, t->isMotorEnabled());
return 1;
}
int _wrap_RevoluteJoint_setMaxMotorTorque(lua_State * L)
int w_RevoluteJoint_setMaxMotorTorque(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -68,14 +68,14 @@ namespace box2d
return 0;
}
int _wrap_RevoluteJoint_getMaxMotorTorque(lua_State * L)
int w_RevoluteJoint_getMaxMotorTorque(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_pushnumber(L, t->getMaxMotorTorque());
return 1;
}
int _wrap_RevoluteJoint_setMotorSpeed(lua_State * L)
int w_RevoluteJoint_setMotorSpeed(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -83,21 +83,21 @@ namespace box2d
return 0;
}
int _wrap_RevoluteJoint_getMotorSpeed(lua_State * L)
int w_RevoluteJoint_getMotorSpeed(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_pushnumber(L, t->getMotorSpeed());
return 1;
}
int _wrap_RevoluteJoint_getMotorTorque(lua_State * L)
int w_RevoluteJoint_getMotorTorque(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_pushnumber(L, t->getMotorTorque());
return 1;
}
int _wrap_RevoluteJoint_setLimitsEnabled(lua_State * L)
int w_RevoluteJoint_setLimitsEnabled(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
@@ -105,14 +105,14 @@ namespace box2d
return 0;
}
int _wrap_RevoluteJoint_isLimitsEnabled(lua_State * L)
int w_RevoluteJoint_isLimitsEnabled(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
luax_pushboolean(L, t->isLimitsEnabled());
return 1;
}
int _wrap_RevoluteJoint_setUpperLimit(lua_State * L)
int w_RevoluteJoint_setUpperLimit(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -120,7 +120,7 @@ namespace box2d
return 0;
}
int _wrap_RevoluteJoint_setLowerLimit(lua_State * L)
int w_RevoluteJoint_setLowerLimit(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -128,7 +128,7 @@ namespace box2d
return 0;
}
int _wrap_RevoluteJoint_setLimits(lua_State * L)
int w_RevoluteJoint_setLimits(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -137,59 +137,57 @@ namespace box2d
return 0;
}
int _wrap_RevoluteJoint_getLowerLimit(lua_State * L)
int w_RevoluteJoint_getLowerLimit(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_pushnumber(L, t->getLowerLimit());
return 1;
}
int _wrap_RevoluteJoint_getUpperLimit(lua_State * L)
int w_RevoluteJoint_getUpperLimit(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_pushnumber(L, t->getUpperLimit());
return 1;
}
int _wrap_RevoluteJoint_getLimits(lua_State * L)
int w_RevoluteJoint_getLimits(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_remove(L, 1);
return t->getLimits(L);
}
static const luaL_Reg wrap_RevoluteJoint_functions[] = {
{ "getJointAngle", _wrap_RevoluteJoint_getJointAngle },
{ "getJointSpeed", _wrap_RevoluteJoint_getJointSpeed },
{ "setMotorEnabled", _wrap_RevoluteJoint_setMotorEnabled },
{ "isMotorEnabled", _wrap_RevoluteJoint_isMotorEnabled },
{ "setMaxMotorTorque", _wrap_RevoluteJoint_setMaxMotorTorque },
{ "getMaxMotorTorque", _wrap_RevoluteJoint_getMaxMotorTorque },
{ "setMotorSpeed", _wrap_RevoluteJoint_setMotorSpeed },
{ "getMotorSpeed", _wrap_RevoluteJoint_getMotorSpeed },
{ "getMotorTorque", _wrap_RevoluteJoint_getMotorTorque },
{ "setLimitsEnabled", _wrap_RevoluteJoint_setLimitsEnabled },
{ "isLimitsEnabled", _wrap_RevoluteJoint_isLimitsEnabled },
{ "setUpperLimit", _wrap_RevoluteJoint_setUpperLimit },
{ "setLowerLimit", _wrap_RevoluteJoint_setLowerLimit },
{ "setLimits", _wrap_RevoluteJoint_setLimits },
{ "getLowerLimit", _wrap_RevoluteJoint_getLowerLimit },
{ "getUpperLimit", _wrap_RevoluteJoint_getUpperLimit },
{ "getLimits", _wrap_RevoluteJoint_getLimits },
// From Joint.
{ "getType", _wrap_Joint_getType },
{ "getAnchors", _wrap_Joint_getAnchors },
{ "getReactionForce", _wrap_Joint_getReactionForce },
{ "getReactionTorque", _wrap_Joint_getReactionTorque },
{ "setCollideConnected", _wrap_Joint_setCollideConnected },
{ "getCollideConnected", _wrap_Joint_getCollideConnected },
{ 0, 0 }
};
int wrap_RevoluteJoint_open(lua_State * L)
int luaopen_revolutejoint(lua_State * L)
{
luax_register_type(L, "RevoluteJoint", wrap_RevoluteJoint_functions);
return 0;
static const luaL_Reg functions[] = {
{ "getJointAngle", w_RevoluteJoint_getJointAngle },
{ "getJointSpeed", w_RevoluteJoint_getJointSpeed },
{ "setMotorEnabled", w_RevoluteJoint_setMotorEnabled },
{ "isMotorEnabled", w_RevoluteJoint_isMotorEnabled },
{ "setMaxMotorTorque", w_RevoluteJoint_setMaxMotorTorque },
{ "getMaxMotorTorque", w_RevoluteJoint_getMaxMotorTorque },
{ "setMotorSpeed", w_RevoluteJoint_setMotorSpeed },
{ "getMotorSpeed", w_RevoluteJoint_getMotorSpeed },
{ "getMotorTorque", w_RevoluteJoint_getMotorTorque },
{ "setLimitsEnabled", w_RevoluteJoint_setLimitsEnabled },
{ "isLimitsEnabled", w_RevoluteJoint_isLimitsEnabled },
{ "setUpperLimit", w_RevoluteJoint_setUpperLimit },
{ "setLowerLimit", w_RevoluteJoint_setLowerLimit },
{ "setLimits", w_RevoluteJoint_setLimits },
{ "getLowerLimit", w_RevoluteJoint_getLowerLimit },
{ "getUpperLimit", w_RevoluteJoint_getUpperLimit },
{ "getLimits", w_RevoluteJoint_getLimits },
// From Joint.
{ "getType", w_Joint_getType },
{ "getAnchors", w_Joint_getAnchors },
{ "getReactionForce", w_Joint_getReactionForce },
{ "getReactionTorque", w_Joint_getReactionTorque },
{ "setCollideConnected", w_Joint_setCollideConnected },
{ "getCollideConnected", w_Joint_getCollideConnected },
{ 0, 0 }
};
return luax_register_type(L, "RevoluteJoint", functions);
}
} // box2d
+18 -18
View File
@@ -33,24 +33,24 @@ namespace physics
namespace box2d
{
RevoluteJoint * luax_checkrevolutejoint(lua_State * L, int idx);
int _wrap_RevoluteJoint_getJointAngle(lua_State * L);
int _wrap_RevoluteJoint_getJointSpeed(lua_State * L);
int _wrap_RevoluteJoint_setMotorEnabled(lua_State * L);
int _wrap_RevoluteJoint_isMotorEnabled(lua_State * L);
int _wrap_RevoluteJoint_setMaxMotorTorque(lua_State * L);
int _wrap_RevoluteJoint_getMaxMotorTorque(lua_State * L);
int _wrap_RevoluteJoint_setMotorSpeed(lua_State * L);
int _wrap_RevoluteJoint_getMotorSpeed(lua_State * L);
int _wrap_RevoluteJoint_getMotorTorque(lua_State * L);
int _wrap_RevoluteJoint_setLimitsEnabled(lua_State * L);
int _wrap_RevoluteJoint_isLimitsEnabled(lua_State * L);
int _wrap_RevoluteJoint_setUpperLimit(lua_State * L);
int _wrap_RevoluteJoint_setLowerLimit(lua_State * L);
int _wrap_RevoluteJoint_setLimits(lua_State * L);
int _wrap_RevoluteJoint_getLowerLimit(lua_State * L);
int _wrap_RevoluteJoint_getUpperLimit(lua_State * L);
int _wrap_RevoluteJoint_getLimits(lua_State * L);
int wrap_RevoluteJoint_open(lua_State * L);
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_getMaxMotorTorque(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_setLimitsEnabled(lua_State * L);
int w_RevoluteJoint_isLimitsEnabled(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);
int luaopen_revolutejoint(lua_State * L);
} // box2d
} // physics
+41 -42
View File
@@ -28,17 +28,17 @@ namespace box2d
{
Shape * luax_checkshape(lua_State * L, int idx)
{
return luax_checktype<Shape>(L, idx, "Shape", LOVE_PHYSICS_SHAPE_BITS);
return luax_checktype<Shape>(L, idx, "Shape", PHYSICS_SHAPE_T);
}
int _wrap_Shape_getType(lua_State * L)
int w_Shape_getType(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_pushinteger(L, t->getType());
return 1;
}
int _wrap_Shape_setFriction(lua_State * L)
int w_Shape_setFriction(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -46,7 +46,7 @@ namespace box2d
return 0;
}
int _wrap_Shape_setRestitution(lua_State * L)
int w_Shape_setRestitution(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -54,7 +54,7 @@ namespace box2d
return 0;
}
int _wrap_Shape_setDensity(lua_State * L)
int w_Shape_setDensity(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -62,7 +62,7 @@ namespace box2d
return 0;
}
int _wrap_Shape_setSensor(lua_State * L)
int w_Shape_setSensor(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
bool arg1 = luax_toboolean(L, 2);
@@ -70,45 +70,45 @@ namespace box2d
return 0;
}
int _wrap_Shape_getFriction(lua_State * L)
int w_Shape_getFriction(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_pushnumber(L, t->getFriction());
return 1;
}
int _wrap_Shape_getRestituion(lua_State * L)
int w_Shape_getRestituion(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_pushnumber(L, t->getRestituion());
return 1;
}
int _wrap_Shape_getDensity(lua_State * L)
int w_Shape_getDensity(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_pushnumber(L, t->getDensity());
return 1;
}
int _wrap_Shape_isSensor(lua_State * L)
int w_Shape_isSensor(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
luax_pushboolean(L, t->isSensor());
return 1;
}
int _wrap_Shape_getBody(lua_State * L)
int w_Shape_getBody(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
Body * body = t->getBody();
if(body == 0)
return 0;
luax_newtype(L, "Body", LOVE_PHYSICS_BODY_BITS, (void*)body);
luax_newtype(L, "Body", PHYSICS_BODY_T, (void*)body);
return 1;
}
int _wrap_Shape_testPoint(lua_State * L)
int w_Shape_testPoint(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
float x = (float)luaL_checknumber(L, 2);
@@ -117,13 +117,13 @@ namespace box2d
return 1;
}
int _wrap_Shape_testSegment(lua_State * L)
int w_Shape_testSegment(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
return t->testSegment(L);
}
int _wrap_Shape_setFilterData(lua_State * L)
int w_Shape_setFilterData(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
int v[3];
@@ -134,7 +134,7 @@ namespace box2d
return 0;
}
int _wrap_Shape_getFilterData(lua_State * L)
int w_Shape_getFilterData(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
int v[3];
@@ -145,51 +145,50 @@ namespace box2d
return 3;
}
int _wrap_Shape_setData(lua_State * L)
int w_Shape_setData(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_remove(L, 1);
return t->setData(L);
}
int _wrap_Shape_getData(lua_State * L)
int w_Shape_getData(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_remove(L, 1);
return t->getData(L);
}
int _wrap_Shape_getBoundingBox(lua_State * L)
int w_Shape_getBoundingBox(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_remove(L, 1);
return t->getBoundingBox(L);
}
static const luaL_Reg wrap_Shape_functions[] = {
{ "getType", _wrap_Shape_getType },
{ "setFriction", _wrap_Shape_setFriction },
{ "setRestitution", _wrap_Shape_setRestitution },
{ "setDensity", _wrap_Shape_setDensity },
{ "setSensor", _wrap_Shape_setSensor },
{ "getFriction", _wrap_Shape_getFriction },
{ "getRestituion", _wrap_Shape_getRestituion },
{ "getDensity", _wrap_Shape_getDensity },
{ "isSensor", _wrap_Shape_isSensor },
{ "testPoint", _wrap_Shape_testPoint },
{ "testSegment", _wrap_Shape_testSegment },
{ "setFilterData", _wrap_Shape_setFilterData },
{ "getFilterData", _wrap_Shape_getFilterData },
{ "setData", _wrap_Shape_setData },
{ "getData", _wrap_Shape_getData },
{ "getBoundingBox", _wrap_Shape_getBoundingBox },
{ 0, 0 }
};
int wrap_Shape_open(lua_State * L)
int w_Shape_open(lua_State * L)
{
luax_register_type(L, "Shape", wrap_Shape_functions);
return 0;
static const luaL_Reg functions[] = {
{ "getType", w_Shape_getType },
{ "setFriction", w_Shape_setFriction },
{ "setRestitution", w_Shape_setRestitution },
{ "setDensity", w_Shape_setDensity },
{ "setSensor", w_Shape_setSensor },
{ "getFriction", w_Shape_getFriction },
{ "getRestituion", w_Shape_getRestituion },
{ "getDensity", w_Shape_getDensity },
{ "isSensor", w_Shape_isSensor },
{ "testPoint", w_Shape_testPoint },
{ "testSegment", w_Shape_testSegment },
{ "setFilterData", w_Shape_setFilterData },
{ "getFilterData", w_Shape_getFilterData },
{ "setData", w_Shape_setData },
{ "getData", w_Shape_getData },
{ "getBoundingBox", w_Shape_getBoundingBox },
{ 0, 0 }
};
return luax_register_type(L, "Shape", functions);
}
} // box2d
+18 -18
View File
@@ -32,24 +32,24 @@ namespace physics
namespace box2d
{
Shape * luax_checkshape(lua_State * L, int idx);
int _wrap_Shape_getType(lua_State * L);
int _wrap_Shape_setFriction(lua_State * L);
int _wrap_Shape_setRestitution(lua_State * L);
int _wrap_Shape_setDensity(lua_State * L);
int _wrap_Shape_setSensor(lua_State * L);
int _wrap_Shape_getFriction(lua_State * L);
int _wrap_Shape_getRestituion(lua_State * L);
int _wrap_Shape_getDensity(lua_State * L);
int _wrap_Shape_isSensor(lua_State * L);
int _wrap_Shape_getBody(lua_State * L);
int _wrap_Shape_testPoint(lua_State * L);
int _wrap_Shape_testSegment(lua_State * L);
int _wrap_Shape_setFilterData(lua_State * L);
int _wrap_Shape_getFilterData(lua_State * L);
int _wrap_Shape_setData(lua_State * L);
int _wrap_Shape_getData(lua_State * L);
int _wrap_Shape_getBoundingBox(lua_State * L);
int wrap_Shape_open(lua_State * L);
int w_Shape_getType(lua_State * L);
int w_Shape_setFriction(lua_State * L);
int w_Shape_setRestitution(lua_State * L);
int w_Shape_setDensity(lua_State * L);
int w_Shape_setSensor(lua_State * L);
int w_Shape_getFriction(lua_State * L);
int w_Shape_getRestituion(lua_State * L);
int w_Shape_getDensity(lua_State * L);
int w_Shape_isSensor(lua_State * L);
int w_Shape_getBody(lua_State * L);
int w_Shape_testPoint(lua_State * L);
int w_Shape_testSegment(lua_State * L);
int w_Shape_setFilterData(lua_State * L);
int w_Shape_getFilterData(lua_State * L);
int w_Shape_setData(lua_State * L);
int w_Shape_getData(lua_State * L);
int w_Shape_getBoundingBox(lua_State * L);
int luaopen_shape(lua_State * L);
} // box2d
} // physics
+29 -30
View File
@@ -29,10 +29,10 @@ namespace box2d
World * luax_checkworld(lua_State * L, int idx)
{
return luax_checktype<World>(L, idx, "World", LOVE_PHYSICS_WORLD_BITS);
return luax_checktype<World>(L, idx, "World", PHYSICS_WORLD_T);
}
int _wrap_World_update(lua_State * L)
int w_World_update(lua_State * L)
{
World * t = luax_checkworld(L, 1);
float dt = (float)luaL_checknumber(L, 2);
@@ -40,21 +40,21 @@ namespace box2d
return 0;
}
int _wrap_World_setCallback(lua_State * L)
int w_World_setCallback(lua_State * L)
{
World * t = luax_checkworld(L, 1);
lua_remove(L, 1);
return t->setCallback(L);
}
int _wrap_World_getCallback(lua_State * L)
int w_World_getCallback(lua_State * L)
{
World * t = luax_checkworld(L, 1);
lua_remove(L, 1);
return t->getCallback(L);
}
int _wrap_World_setGravity(lua_State * L)
int w_World_setGravity(lua_State * L)
{
World * t = luax_checkworld(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
@@ -63,14 +63,14 @@ namespace box2d
return 0;
}
int _wrap_World_getGravity(lua_State * L)
int w_World_getGravity(lua_State * L)
{
World * t = luax_checkworld(L, 1);
lua_remove(L, 1);
return t->getGravity(L);
}
int _wrap_World_setAllowSleep(lua_State * L)
int w_World_setAllowSleep(lua_State * L)
{
World * t = luax_checkworld(L, 1);
bool b = luax_toboolean(L, 2);
@@ -78,28 +78,28 @@ namespace box2d
return 0;
}
int _wrap_World_isAllowSleep(lua_State * L)
int w_World_isAllowSleep(lua_State * L)
{
World * t = luax_checkworld(L, 1);
luax_pushboolean(L, t->isAllowSleep());
return 1;
}
int _wrap_World_getBodyCount(lua_State * L)
int w_World_getBodyCount(lua_State * L)
{
World * t = luax_checkworld(L, 1);
lua_pushinteger(L, t->getBodyCount());
return 1;
}
int _wrap_World_getJointCount(lua_State * L)
int w_World_getJointCount(lua_State * L)
{
World * t = luax_checkworld(L, 1);
lua_pushinteger(L, t->getJointCount());
return 1;
}
int _wrap_World_setMeter(lua_State * L)
int w_World_setMeter(lua_State * L)
{
World * t = luax_checkworld(L, 1);
int arg1 = luaL_checkint(L, 2);
@@ -107,32 +107,31 @@ namespace box2d
return 0;
}
int _wrap_World_getMeter(lua_State * L)
int w_World_getMeter(lua_State * L)
{
World * t = luax_checkworld(L, 1);
lua_pushinteger(L, t->getMeter());
return 1;
}
static const luaL_Reg wrap_World_functions[] = {
{ "update", _wrap_World_update },
{ "setCallback", _wrap_World_setCallback },
{ "getCallback", _wrap_World_getCallback },
{ "setGravity", _wrap_World_setGravity },
{ "getGravity", _wrap_World_getGravity },
{ "setAllowSleep", _wrap_World_setAllowSleep },
{ "isAllowSleep", _wrap_World_isAllowSleep },
{ "getBodyCount", _wrap_World_getBodyCount },
{ "getJointCount", _wrap_World_getJointCount },
{ "setMeter", _wrap_World_setMeter },
{ "getMeter", _wrap_World_getMeter },
{ 0, 0 }
};
int wrap_World_open(lua_State * L)
int luaopen_world(lua_State * L)
{
luax_register_type(L, "World", wrap_World_functions);
return 0;
static const luaL_Reg functions[] = {
{ "update", w_World_update },
{ "setCallback", w_World_setCallback },
{ "getCallback", w_World_getCallback },
{ "setGravity", w_World_setGravity },
{ "getGravity", w_World_getGravity },
{ "setAllowSleep", w_World_setAllowSleep },
{ "isAllowSleep", w_World_isAllowSleep },
{ "getBodyCount", w_World_getBodyCount },
{ "getJointCount", w_World_getJointCount },
{ "setMeter", w_World_setMeter },
{ "getMeter", w_World_getMeter },
{ 0, 0 }
};
return luax_register_type(L, "World", functions);
}
} // box2d
+12 -12
View File
@@ -32,18 +32,18 @@ namespace physics
namespace box2d
{
World * luax_checkworld(lua_State * L, int idx);
int _wrap_World_update(lua_State * L);
int _wrap_World_setCallback(lua_State * L);
int _wrap_World_getCallback(lua_State * L);
int _wrap_World_setGravity(lua_State * L);
int _wrap_World_getGravity(lua_State * L);
int _wrap_World_setAllowSleep(lua_State * L);
int _wrap_World_isAllowSleep(lua_State * L);
int _wrap_World_getBodyCount(lua_State * L);
int _wrap_World_getJointCount(lua_State * L);
int _wrap_World_setMeter(lua_State * L);
int _wrap_World_getMeter(lua_State * L);
int wrap_World_open(lua_State * L);
int w_World_update(lua_State * L);
int w_World_setCallback(lua_State * L);
int w_World_getCallback(lua_State * L);
int w_World_setGravity(lua_State * L);
int w_World_getGravity(lua_State * L);
int w_World_setAllowSleep(lua_State * L);
int w_World_isAllowSleep(lua_State * L);
int w_World_getBodyCount(lua_State * L);
int w_World_getJointCount(lua_State * L);
int w_World_setMeter(lua_State * L);
int w_World_getMeter(lua_State * L);
int luaopen_world(lua_State * L);
} // box2d
} // physics