Switched get/setMeter from being a World method to a love.physics function

--HG--
branch : box2d-update
This commit is contained in:
Bill Meltsner
2011-09-15 16:13:54 -04:00
parent 1fa99d022a
commit e69cafe868
22 changed files with 270 additions and 256 deletions
+5 -4
View File
@@ -23,6 +23,7 @@
// Module
#include "Body.h"
#include "World.h"
#include "Physics.h"
namespace love
{
@@ -38,7 +39,7 @@ namespace box2d
def.bodyA = body1->world->getGroundBody();
def.bodyB = body1->body;
def.maxForce = 1000.0f * body1->body->GetMass();
def.target = body1->world->scaleDown(b2Vec2(x,y));
def.target = Physics::scaleDown(b2Vec2(x,y));
joint = (b2MouseJoint*)createJoint(&def);
}
@@ -50,13 +51,13 @@ namespace box2d
void MouseJoint::setTarget(float x, float y)
{
joint->SetTarget(world->scaleDown(b2Vec2(x, y)));
joint->SetTarget(Physics::scaleDown(b2Vec2(x, y)));
}
int MouseJoint::getTarget(lua_State * L)
{
lua_pushnumber(L, world->scaleUp(joint->GetTarget().x));
lua_pushnumber(L, world->scaleUp(joint->GetTarget().y));
lua_pushnumber(L, Physics::scaleUp(joint->GetTarget().x));
lua_pushnumber(L, Physics::scaleUp(joint->GetTarget().y));
return 2;
}