Changed function names of love.physics to match Box2D.

This commit is contained in:
rude
2009-08-04 23:05:49 +02:00
parent cc9a142a98
commit 797f536f05
22 changed files with 157 additions and 236 deletions
+16 -14
View File
@@ -63,7 +63,7 @@ namespace box2d
return pushVector(L, world->scaleUp(body->GetPosition()));
}
int Body::getVelocity(lua_State * L)
int Body::getLinearVelocity(lua_State * L)
{
return pushVector(L, world->scaleUp(body->GetLinearVelocity()));
}
@@ -83,7 +83,7 @@ namespace box2d
return pushVector(L, world->scaleUp(body->GetLocalCenter()));
}
float Body::getSpin() const
float Body::getAngularVelocity() const
{
return body->GetAngularVelocity();
}
@@ -103,7 +103,7 @@ namespace box2d
return body->m_angularDamping;
}
float Body::getDamping() const
float Body::getLinearDamping() const
{
return body->m_linearDamping;
}
@@ -143,7 +143,7 @@ namespace box2d
body->SetXForm(world->scaleDown(b2Vec2(getX(), y)), getAngle());
}
void Body::setVelocity(float x, float y)
void Body::setLinearVelocity(float x, float y)
{
body->SetLinearVelocity(world->scaleDown(b2Vec2(x, y)));
}
@@ -153,7 +153,7 @@ namespace box2d
body->SetXForm(body->GetPosition(), d);
}
void Body::setSpin(float r)
void Body::setAngularVelocity(float r)
{
body->SetAngularVelocity(r);
}
@@ -168,7 +168,7 @@ namespace box2d
body->m_angularDamping = d;
}
void Body::setDamping(float d)
void Body::setLinearDamping(float d)
{
body->m_linearDamping = d;
}
@@ -211,13 +211,13 @@ namespace box2d
return pushVector(L, world->scaleUp(body->GetLocalVector(v)));
}
int Body::getVelocityWorldPoint(lua_State * L)
int Body::getLinearVelocityFromWorldPoint(lua_State * L)
{
b2Vec2 v = world->scaleDown(getVector(L));
return pushVector(L, world->scaleUp(body->GetLinearVelocityFromWorldPoint(v)));
}
int Body::getVelocityLocalPoint(lua_State * L)
int Body::getLinearVelocityFromLocalPoint(lua_State * L)
{
b2Vec2 v = world->scaleDown(getVector(L));
return pushVector(L, world->scaleUp(body->GetLinearVelocityFromLocalPoint(v)));
@@ -253,17 +253,19 @@ namespace box2d
return body->IsSleeping();
}
void Body::setAllowSleep(bool allow)
void Body::setAllowSleeping(bool allow)
{
body->AllowSleeping(true);
}
void Body::setSleep(bool sleep)
void Body::putToSleep()
{
if(sleep)
body->PutToSleep();
else
body->WakeUp();
body->PutToSleep();
}
void Body::wakeUp()
{
body->WakeUp();
}
b2Vec2 Body::getVector(lua_State * L)
+16 -12
View File
@@ -103,7 +103,7 @@ namespace box2d
* @returns The x-component of the velocity.
* @returns The y-component of the velocity.
**/
int getVelocity(lua_State * L);
int getLinearVelocity(lua_State * L);
/**
* The current center of mass for the Body in world
@@ -124,7 +124,7 @@ namespace box2d
/**
* Get the current Body spin. (Angular velocity).
**/
float getSpin() const;
float getAngularVelocity() const;
/**
* Gets the Body's mass.
@@ -144,7 +144,7 @@ namespace box2d
/**
* Gets the Body's linear damping.
**/
float getDamping() const;
float getLinearDamping() const;
/**
* Apply an impulse (jx, jy) with offset (0, 0).
@@ -184,7 +184,7 @@ namespace box2d
/**
* Sets the current velocity of the Body.
**/
void setVelocity(float x, float y);
void setLinearVelocity(float x, float y);
/**
* Sets the angle of the Body.
@@ -194,7 +194,7 @@ namespace box2d
/**
* Sets the current spin of the Body.
**/
void setSpin(float r);
void setAngularVelocity(float r);
/**
* Sets the current position of the Body.
@@ -223,7 +223,7 @@ namespace box2d
/**
* Sets the Body's linear damping.
**/
void setDamping(float d);
void setLinearDamping(float d);
/**
* Transforms a point (x, y) from local coordinates
@@ -272,7 +272,7 @@ namespace box2d
* @returns The x-component of the velocity vector.
* @returns The y-component of the velocity vector.
**/
int getVelocityWorldPoint(lua_State * L);
int getLinearVelocityFromWorldPoint(lua_State * L);
/**
* Gets the velocity on the Body for the given local point.
@@ -281,7 +281,7 @@ namespace box2d
* @returns The x-component of the velocity vector.
* @returns The y-component of the velocity vector.
**/
int getVelocityLocalPoint(lua_State * L);
int getLinearVelocityFromLocalPoint(lua_State * L);
/**
* Returns true if the Body is a bullet, false otherwise.
@@ -320,13 +320,17 @@ namespace box2d
/**
* Controls whether this Body should be allowed to sleep.
**/
void setAllowSleep(bool allow);
void setAllowSleeping(bool allow);
/**
* Controls the Body's sleep.
* @param sleep True to put to sleep, false to wake up.
* Puts the body to sleep.
**/
void setSleep(bool sleep);
void putToSleep();
/**
* Wakes the Body up.
**/
void wakeUp();
private:
+2 -2
View File
@@ -64,12 +64,12 @@ namespace box2d
return joint->m_frequencyHz;
}
void DistanceJoint::setDamping(float d)
void DistanceJoint::setDampingRatio(float d)
{
joint->m_dampingRatio = d;
}
float DistanceJoint::getDamping() const
float DistanceJoint::getDampingRatio() const
{
return joint->m_dampingRatio;
}
+2 -2
View File
@@ -72,13 +72,13 @@ namespace box2d
* Sets the damping ratio.
* 0 = no damping, 1 = critical damping.
**/
void setDamping(float d);
void setDampingRatio(float d);
/**
* Gets the damping ratio.
* 0 = no damping, 1 = critical damping.
**/
float getDamping() const;
float getDampingRatio() const;
};
+3 -3
View File
@@ -48,12 +48,12 @@ namespace box2d
joint = 0;
}
float PrismaticJoint::getTranslation() const
float PrismaticJoint::getJointTranslation() const
{
return world->scaleDown(joint->GetJointTranslation());
}
float PrismaticJoint::getSpeed() const
float PrismaticJoint::getJointSpeed() const
{
return world->scaleDown(joint->GetJointSpeed());
}
@@ -75,7 +75,7 @@ namespace box2d
float PrismaticJoint::getMaxMotorForce() const
{
return joint->GetMotorForce();
return joint->m_maxMotorForce;
}
void PrismaticJoint::setMotorSpeed(float speed)
+2 -2
View File
@@ -53,12 +53,12 @@ namespace box2d
/**
* Get the current joint translation, usually in meters.
**/
float getTranslation() const;
float getJointTranslation() const;
/**
* Get the current joint translation speed, usually in meters per second.
**/
float getSpeed() const;
float getJointSpeed() const;
/**
* Enable/disable the joint motor.
+3 -3
View File
@@ -46,12 +46,12 @@ namespace box2d
joint = 0;
}
float RevoluteJoint::getAngle() const
float RevoluteJoint::getJointAngle() const
{
return joint->GetJointAngle();
}
float RevoluteJoint::getSpeed() const
float RevoluteJoint::getJointSpeed() const
{
return joint->GetJointSpeed();
}
@@ -73,7 +73,7 @@ namespace box2d
float RevoluteJoint::getMaxMotorTorque() const
{
return joint->GetMotorTorque();
return joint->m_maxMotorTorque;
}
void RevoluteJoint::setMotorSpeed(float speed)
+2 -2
View File
@@ -53,12 +53,12 @@ namespace box2d
/**
* Get the current joint angle in degrees.
**/
float getAngle() const;
float getJointAngle() const;
/**
* Get the current joint angle speed in degrees per second.
**/
float getSpeed() const;
float getJointSpeed() const;
/**
* Enable/disable the joint motor.
+9 -52
View File
@@ -142,32 +142,22 @@ namespace box2d
return 0;
}
int Shape::setCategory(lua_State * L)
void Shape::setFilterData(int * v)
{
b2FilterData f = shape->GetFilterData();
f.categoryBits = (uint16)getBits(L);
b2FilterData f;
f.categoryBits = (unsigned short)v[0];
f.maskBits = (unsigned short)v[1];
f.groupIndex = v[2];
shape->SetFilterData(f);
shape->GetBody()->GetWorld()->Refilter(shape);
return 0;
}
int Shape::setMask(lua_State * L)
void Shape::getFilterData(int * v)
{
b2FilterData f = shape->GetFilterData();
f.maskBits = ~(uint16)getBits(L);
shape->SetFilterData(f);
shape->GetBody()->GetWorld()->Refilter(shape);
return 0;
}
int Shape::getCategory(lua_State * L)
{
return pushBits(L, shape->GetFilterData().categoryBits);
}
int Shape::getMask(lua_State * L)
{
return pushBits(L, ~(shape->GetFilterData().maskBits));
v[0] = (int)f.categoryBits;
v[1] = (int)f.maskBits;
v[2] = f.groupIndex;
}
int Shape::setData(lua_State * L)
@@ -221,39 +211,6 @@ namespace box2d
return 8;
}
uint16 Shape::getBits(lua_State * L)
{
// Get number of args.
int argc = lua_gettop(L);
// The new bitset.
std::bitset<16> b;
for(int i = 1;i<=argc;i++)
{
size_t bpos = (size_t)(lua_tointeger(L, i)-1);
if(bpos < 0 || bpos > 16)
return luaL_error(L, "Values must be in range 1-16.");
b.set(bpos, true);
}
return (uint16)b.to_ulong();
}
int Shape::pushBits(lua_State * L, uint16 bits)
{
// Create a bitset.
std::bitset<16> b((unsigned long)bits);
// Push all set bits.
for(int i = 0;i<16;i++)
if(b.test(i))
lua_pushinteger(L, i+1);
// Count number of set bits.
return (int)b.count();
}
} // box2d
} // physics
} // love
+8 -44
View File
@@ -155,38 +155,18 @@ namespace box2d
int testSegment(lua_State * L);
/**
* With this function, you can easily set the categories
* a Shape is a member of.
*
* The function accepts 1-16 arguments. Each argument must
* be a number from 1-16, and must be unique in the list.
* Sets the filter data. An integer array is used even though the
* first two elements are unsigned shorts. The elements are:
* category (16-bits), mask (16-bits) and group (32-bits/int).
**/
int setCategory(lua_State * L);
void setFilterData(int * v);
/**
* Returns the categories this Shape is
* a member of. So if the Shape is a member
* of 5 categories, this function returns five
* values.
**/
int getCategory(lua_State * L);
/**
* Sets which categories this Shape should *not*
* collide with.
*
* The function works the same was as setCategory, but
* each entry here represents a 0 in the bit string, not
* a 1 like setCategory.
* Gets the filter data. An integer array is used even though the
* first two elements are unsigned shorts. The elements are:
* category (16-bits), mask (16-bits) and group (32-bits/int).
**/
int setMask(lua_State * L);
/**
* Returns the current masked categories.
* If there are 5 masked categories, then this
* function will have 5 return values.
**/
int getMask(lua_State * L);
void getFilterData(int * v);
/**
* This function stores an in-C reference to
@@ -209,22 +189,6 @@ namespace box2d
* passed directly to love.graphics.polygon.
**/
int getBoundingBox(lua_State * L);
private:
/**
* Gets a 16-integer from the current stack top.
* @param The 16-bit integer.
**/
uint16 getBits(lua_State * L);
/**
* Push each set bit in a 16-bit integer as
* a list of integer indices. That is, if the bits are
* set to 0000 0000 0011 0001, then this function will
* push (1, 5, 6) on the stack.
**/
int pushBits(lua_State * L, uint16 bits);
};
} // box2d
+38 -31
View File
@@ -58,10 +58,10 @@ namespace box2d
return t->getPosition(L);
}
int _wrap_Body_getVelocity(lua_State * L)
int _wrap_Body_getLinearVelocity(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getVelocity(L);
return t->getLinearVelocity(L);
}
int _wrap_Body_getWorldCenter(lua_State * L)
@@ -76,10 +76,10 @@ namespace box2d
return t->getLocalCenter(L);
}
int _wrap_Body_getSpin(lua_State * L)
int _wrap_Body_getAngularVelocity(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getSpin());
lua_pushnumber(L, t->getAngularVelocity());
return 1;
}
@@ -104,10 +104,10 @@ namespace box2d
return 1;
}
int _wrap_Body_getDamping(lua_State * L)
int _wrap_Body_getLinearDamping(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
lua_pushnumber(L, t->getDamping());
lua_pushnumber(L, t->getLinearDamping());
return 1;
}
@@ -157,12 +157,12 @@ namespace box2d
return 0;
}
int _wrap_Body_setVelocity(lua_State * L)
int _wrap_Body_setLinearVelocity(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
float arg2 = (float)luaL_checknumber(L, 3);
t->setVelocity(arg1, arg2);
t->setLinearVelocity(arg1, arg2);
return 0;
}
@@ -174,11 +174,11 @@ namespace box2d
return 0;
}
int _wrap_Body_setSpin(lua_State * L)
int _wrap_Body_setAngularVelocity(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
t->setSpin(arg1);
t->setAngularVelocity(arg1);
return 0;
}
@@ -217,11 +217,11 @@ namespace box2d
return 0;
}
int _wrap_Body_setDamping(lua_State * L)
int _wrap_Body_setLinearDamping(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
t->setDamping(arg1);
t->setLinearDamping(arg1);
return 0;
}
@@ -249,16 +249,16 @@ namespace box2d
return t->getLocalVector(L);
}
int _wrap_Body_getVelocityWorldPoint(lua_State * L)
int _wrap_Body_getLinearVelocityFromWorldPoint(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getVelocityWorldPoint(L);
return t->getLinearVelocityFromWorldPoint(L);
}
int _wrap_Body_getVelocityLocalPoint(lua_State * L)
int _wrap_Body_getLinearVelocityFromLocalPoint(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
return t->getVelocityLocalPoint(L);
return t->getLinearVelocityFromLocalPoint(L);
}
int _wrap_Body_isBullet(lua_State * L)
@@ -304,19 +304,25 @@ namespace box2d
return 1;
}
int _wrap_Body_setAllowSleep(lua_State * L)
int _wrap_Body_setAllowSleeping(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
bool b = luax_toboolean(L, 2);
t->setAllowSleep(b);
t->setAllowSleeping(b);
return 0;
}
int _wrap_Body_setSleep(lua_State * L)
int _wrap_Body_putToSleep(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
bool b = luax_toboolean(L, 2);
t->setSleep(b);
t->putToSleep();
return 0;
}
int _wrap_Body_wakeUp(lua_State * L)
{
Body * t = luax_checkbody(L, 1);
t->wakeUp();
return 0;
}
@@ -325,41 +331,42 @@ namespace box2d
{ "getY", _wrap_Body_getY },
{ "getAngle", _wrap_Body_getAngle },
{ "getPosition", _wrap_Body_getPosition },
{ "getVelocity", _wrap_Body_getVelocity },
{ "getLinearVelocity", _wrap_Body_getLinearVelocity },
{ "getWorldCenter", _wrap_Body_getWorldCenter },
{ "getLocalCenter", _wrap_Body_getLocalCenter },
{ "getSpin", _wrap_Body_getSpin },
{ "getAngularVelocity", _wrap_Body_getAngularVelocity },
{ "getMass", _wrap_Body_getMass },
{ "getInertia", _wrap_Body_getInertia },
{ "getAngularDamping", _wrap_Body_getAngularDamping },
{ "getDamping", _wrap_Body_getDamping },
{ "getLinearDamping", _wrap_Body_getLinearDamping },
{ "applyImpulse", _wrap_Body_applyImpulse },
{ "applyTorque", _wrap_Body_applyTorque },
{ "applyForce", _wrap_Body_applyForce },
{ "setX", _wrap_Body_setX },
{ "setY", _wrap_Body_setY },
{ "setVelocity", _wrap_Body_setVelocity },
{ "setLinearVelocity", _wrap_Body_setLinearVelocity },
{ "setAngle", _wrap_Body_setAngle },
{ "setSpin", _wrap_Body_setSpin },
{ "setAngularVelocity", _wrap_Body_setAngularVelocity },
{ "setPosition", _wrap_Body_setPosition },
{ "setMassFromShapes", _wrap_Body_setMassFromShapes },
{ "setMass", _wrap_Body_setMass },
{ "setAngularDamping", _wrap_Body_setAngularDamping },
{ "setDamping", _wrap_Body_setDamping },
{ "setLinearDamping", _wrap_Body_setLinearDamping },
{ "getWorldPoint", _wrap_Body_getWorldPoint },
{ "getWorldVector", _wrap_Body_getWorldVector },
{ "getLocalPoint", _wrap_Body_getLocalPoint },
{ "getLocalVector", _wrap_Body_getLocalVector },
{ "getVelocityWorldPoint", _wrap_Body_getVelocityWorldPoint },
{ "getVelocityLocalPoint", _wrap_Body_getVelocityLocalPoint },
{ "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 },
{ "setAllowSleep", _wrap_Body_setAllowSleep },
{ "setSleep", _wrap_Body_setSleep },
{ "setAllowSleeping", _wrap_Body_setAllowSleeping },
{ "putToSleep", _wrap_Body_putToSleep },
{ "wakeUp", _wrap_Body_wakeUp },
{ 0, 0 }
};
+10 -9
View File
@@ -37,14 +37,14 @@ namespace box2d
int _wrap_Body_getY(lua_State * L);
int _wrap_Body_getAngle(lua_State * L);
int _wrap_Body_getPosition(lua_State * L);
int _wrap_Body_getVelocity(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_getSpin(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_getDamping(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);
@@ -52,26 +52,27 @@ namespace box2d
int _wrap_Body_setY(lua_State * L);
int _wrap_Body_setVelocity(lua_State * L);
int _wrap_Body_setAngle(lua_State * L);
int _wrap_Body_setSpin(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_setDamping(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_getVelocityWorldPoint(lua_State * L);
int _wrap_Body_getVelocityLocalPoint(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_setAllowSleep(lua_State * L);
int _wrap_Body_setSleep(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);
} // box2d
@@ -52,10 +52,8 @@ namespace box2d
{ "isSensor", _wrap_Shape_isSensor },
{ "testPoint", _wrap_Shape_testPoint },
{ "testSegment", _wrap_Shape_testSegment },
{ "setCategory", _wrap_Shape_setCategory },
{ "getCategory", _wrap_Shape_getCategory },
{ "setMask", _wrap_Shape_setMask },
{ "getMask", _wrap_Shape_getMask },
{ "setFilterData", _wrap_Shape_setFilterData },
{ "getFilterData", _wrap_Shape_getFilterData },
{ "setData", _wrap_Shape_setData },
{ "getData", _wrap_Shape_getData },
{ "getBoundingBox", _wrap_Shape_getBoundingBox },
@@ -61,18 +61,18 @@ namespace box2d
return 1;
}
int _wrap_DistanceJoint_setDamping(lua_State * L)
int _wrap_DistanceJoint_setDampingRatio(lua_State * L)
{
DistanceJoint * t = luax_checkdistancejoint(L, 1);
float arg1 = (float)luaL_checknumber(L, 2);
t->setDamping(arg1);
t->setDampingRatio(arg1);
return 0;
}
int _wrap_DistanceJoint_getDamping(lua_State * L)
int _wrap_DistanceJoint_getDampingRatio(lua_State * L)
{
DistanceJoint * t = luax_checkdistancejoint(L, 1);
lua_pushnumber(L, t->getDamping());
lua_pushnumber(L, t->getDampingRatio());
return 1;
}
@@ -81,8 +81,8 @@ namespace box2d
{ "getLength", _wrap_DistanceJoint_getLength },
{ "setFrequency", _wrap_DistanceJoint_setFrequency },
{ "getFrequency", _wrap_DistanceJoint_getFrequency },
{ "setDamping", _wrap_DistanceJoint_setDamping },
{ "getDamping", _wrap_DistanceJoint_getDamping },
{ "setDamping", _wrap_DistanceJoint_setDampingRatio },
{ "getDamping", _wrap_DistanceJoint_getDampingRatio },
// From Joint.
{ "getType", _wrap_Joint_getType },
{ "getAnchors", _wrap_Joint_getAnchors },
@@ -37,8 +37,8 @@ namespace box2d
int _wrap_DistanceJoint_getLength(lua_State * L);
int _wrap_DistanceJoint_setFrequency(lua_State * L);
int _wrap_DistanceJoint_getFrequency(lua_State * L);
int _wrap_DistanceJoint_setDamping(lua_State * L);
int _wrap_DistanceJoint_getDamping(lua_State * L);
int _wrap_DistanceJoint_setDampingRatio(lua_State * L);
int _wrap_DistanceJoint_getDampingRatio(lua_State * L);
int wrap_DistanceJoint_open(lua_State * L);
} // box2d
@@ -52,10 +52,8 @@ namespace box2d
{ "isSensor", _wrap_Shape_isSensor },
{ "testPoint", _wrap_Shape_testPoint },
{ "testSegment", _wrap_Shape_testSegment },
{ "setCategory", _wrap_Shape_setCategory },
{ "getCategory", _wrap_Shape_getCategory },
{ "setMask", _wrap_Shape_setMask },
{ "getMask", _wrap_Shape_getMask },
{ "setFilterData", _wrap_Shape_setFilterData },
{ "getFilterData", _wrap_Shape_getFilterData },
{ "setData", _wrap_Shape_setData },
{ "getData", _wrap_Shape_getData },
{ "getBoundingBox", _wrap_Shape_getBoundingBox },
@@ -31,17 +31,17 @@ namespace box2d
return luax_checktype<PrismaticJoint>(L, idx, "PrismaticJoint", LOVE_PHYSICS_PRISMATIC_JOINT_BITS);
}
int _wrap_PrismaticJoint_getTranslation(lua_State * L)
int _wrap_PrismaticJoint_getJointTranslation(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_pushnumber(L, t->getTranslation());
lua_pushnumber(L, t->getJointTranslation());
return 1;
}
int _wrap_PrismaticJoint_getSpeed(lua_State * L)
int _wrap_PrismaticJoint_getJointSpeed(lua_State * L)
{
PrismaticJoint * t = luax_checkprismaticjoint(L, 1);
lua_pushnumber(L, t->getSpeed());
lua_pushnumber(L, t->getJointSpeed());
return 1;
}
@@ -159,8 +159,8 @@ namespace box2d
}
static const luaL_Reg wrap_PrismaticJoint_functions[] = {
{ "getTranslation", _wrap_PrismaticJoint_getTranslation },
{ "getSpeed", _wrap_PrismaticJoint_getSpeed },
{ "getJointTranslation", _wrap_PrismaticJoint_getJointTranslation },
{ "getJointSpeed", _wrap_PrismaticJoint_getJointSpeed },
{ "setMotorEnabled", _wrap_PrismaticJoint_setMotorEnabled },
{ "isMotorEnabled", _wrap_PrismaticJoint_isMotorEnabled },
{ "setMaxMotorForce", _wrap_PrismaticJoint_setMaxMotorForce },
@@ -33,8 +33,8 @@ namespace physics
namespace box2d
{
PrismaticJoint * luax_checkprismaticjoint(lua_State * L, int idx);
int _wrap_PrismaticJoint_getTranslation(lua_State * L);
int _wrap_PrismaticJoint_getSpeed(lua_State * L);
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);
@@ -31,17 +31,17 @@ namespace box2d
return luax_checktype<RevoluteJoint>(L, idx, "RevoluteJoint", LOVE_PHYSICS_REVOLUTE_JOINT_BITS);
}
int _wrap_RevoluteJoint_getAngle(lua_State * L)
int _wrap_RevoluteJoint_getJointAngle(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_pushnumber(L, t->getAngle());
lua_pushnumber(L, t->getJointAngle());
return 1;
}
int _wrap_RevoluteJoint_getSpeed(lua_State * L)
int _wrap_RevoluteJoint_getJointSpeed(lua_State * L)
{
RevoluteJoint * t = luax_checkrevolutejoint(L, 1);
lua_pushnumber(L, t->getSpeed());
lua_pushnumber(L, t->getJointSpeed());
return 1;
}
@@ -159,8 +159,8 @@ namespace box2d
}
static const luaL_Reg wrap_RevoluteJoint_functions[] = {
{ "getAngle", _wrap_RevoluteJoint_getAngle },
{ "getSpeed", _wrap_RevoluteJoint_getSpeed },
{ "getJointAngle", _wrap_RevoluteJoint_getJointAngle },
{ "getJointSpeed", _wrap_RevoluteJoint_getJointSpeed },
{ "setMotorEnabled", _wrap_RevoluteJoint_setMotorEnabled },
{ "isMotorEnabled", _wrap_RevoluteJoint_isMotorEnabled },
{ "setMaxMotorTorque", _wrap_RevoluteJoint_setMaxMotorTorque },
@@ -33,8 +33,8 @@ namespace physics
namespace box2d
{
RevoluteJoint * luax_checkrevolutejoint(lua_State * L, int idx);
int _wrap_RevoluteJoint_getAngle(lua_State * L);
int _wrap_RevoluteJoint_getSpeed(lua_State * L);
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);
+16 -24
View File
@@ -123,32 +123,26 @@ namespace box2d
return t->testSegment(L);
}
int _wrap_Shape_setCategory(lua_State * L)
int _wrap_Shape_setFilterData(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_remove(L, 1);
return t->setCategory(L);
int v[3];
v[0] = luaL_checkint(L, 2);
v[1] = luaL_checkint(L, 3);
v[2] = luaL_checkint(L, 4);
t->setFilterData(v);
return 0;
}
int _wrap_Shape_getCategory(lua_State * L)
int _wrap_Shape_getFilterData(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_remove(L, 1);
return t->getCategory(L);
}
int _wrap_Shape_setMask(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_remove(L, 1);
return t->setMask(L);
}
int _wrap_Shape_getMask(lua_State * L)
{
Shape * t = luax_checkshape(L, 1);
lua_remove(L, 1);
return t->getMask(L);
int v[3];
t->getFilterData(v);
lua_pushinteger(L, v[0]);
lua_pushinteger(L, v[1]);
lua_pushinteger(L, v[2]);
return 3;
}
int _wrap_Shape_setData(lua_State * L)
@@ -184,10 +178,8 @@ namespace box2d
{ "isSensor", _wrap_Shape_isSensor },
{ "testPoint", _wrap_Shape_testPoint },
{ "testSegment", _wrap_Shape_testSegment },
{ "setCategory", _wrap_Shape_setCategory },
{ "getCategory", _wrap_Shape_getCategory },
{ "setMask", _wrap_Shape_setMask },
{ "getMask", _wrap_Shape_getMask },
{ "setFilterData", _wrap_Shape_setFilterData },
{ "getFilterData", _wrap_Shape_getFilterData },
{ "setData", _wrap_Shape_setData },
{ "getData", _wrap_Shape_getData },
{ "getBoundingBox", _wrap_Shape_getBoundingBox },
+2 -4
View File
@@ -44,10 +44,8 @@ namespace box2d
int _wrap_Shape_getBody(lua_State * L);
int _wrap_Shape_testPoint(lua_State * L);
int _wrap_Shape_testSegment(lua_State * L);
int _wrap_Shape_setCategory(lua_State * L);
int _wrap_Shape_getCategory(lua_State * L);
int _wrap_Shape_setMask(lua_State * L);
int _wrap_Shape_getMask(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);