mirror of
https://github.com/love2d/love-android.git
synced 2026-08-20 12:40:28 +02:00
Using latest changeset 593639000823 of love-android
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -28,6 +28,9 @@
|
||||
#include "World.h"
|
||||
#include "Physics.h"
|
||||
|
||||
// Needed for luax_pushjoint.
|
||||
#include "wrap_Joint.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace physics
|
||||
@@ -440,6 +443,30 @@ int Body::getFixtureList(lua_State *L) const
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Body::getJointList(lua_State *L) const
|
||||
{
|
||||
lua_newtable(L);
|
||||
const b2JointEdge *je = body->GetJointList();
|
||||
int i = 1;
|
||||
|
||||
do
|
||||
{
|
||||
if (!je)
|
||||
break;
|
||||
|
||||
Joint *joint = (Joint *) Memoizer::find(je->joint);
|
||||
if (!joint)
|
||||
throw love::Exception("A joint has escaped Memoizer!");
|
||||
|
||||
luax_pushjoint(L, joint);
|
||||
lua_rawseti(L, -2, i);
|
||||
i++;
|
||||
}
|
||||
while ((je = je->next));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Body::getContactList(lua_State *L) const
|
||||
{
|
||||
lua_newtable(L);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -393,6 +393,11 @@ public:
|
||||
**/
|
||||
int getFixtureList(lua_State *L) const;
|
||||
|
||||
/**
|
||||
* Get an array of all Joints attached to this Body.
|
||||
**/
|
||||
int getJointList(lua_State *L) const;
|
||||
|
||||
/**
|
||||
* Get an array of all active Contacts attached to this Body.
|
||||
* This list changes during World:update and you may miss some collisions
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -23,6 +23,7 @@
|
||||
// Module
|
||||
#include "Body.h"
|
||||
#include "World.h"
|
||||
#include "common/Memoizer.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -60,6 +61,32 @@ float GearJoint::getRatio() const
|
||||
return joint->GetRatio();
|
||||
}
|
||||
|
||||
Joint *GearJoint::getJointA() const
|
||||
{
|
||||
b2Joint *b2joint = joint->GetJoint1();
|
||||
if (b2joint == nullptr)
|
||||
return nullptr;
|
||||
|
||||
Joint *j = (Joint *) Memoizer::find(b2joint);
|
||||
if (j == nullptr)
|
||||
throw love::Exception("A joint has escaped Memoizer!");
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
Joint *GearJoint::getJointB() const
|
||||
{
|
||||
b2Joint *b2joint = joint->GetJoint2();
|
||||
if (b2joint == nullptr)
|
||||
return nullptr;
|
||||
|
||||
Joint *j = (Joint *) Memoizer::find(b2joint);
|
||||
if (j == nullptr)
|
||||
throw love::Exception("A joint has escaped Memoizer!");
|
||||
|
||||
return j;
|
||||
}
|
||||
|
||||
} // box2d
|
||||
} // physics
|
||||
} // love
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -64,6 +64,9 @@ public:
|
||||
**/
|
||||
float getRatio() const;
|
||||
|
||||
Joint *getJointA() const;
|
||||
Joint *getJointB() const;
|
||||
|
||||
private:
|
||||
// The Box2D GearJoint object.
|
||||
b2GearJoint *joint;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -90,11 +90,39 @@ Joint::Type Joint::getType() const
|
||||
return JOINT_WHEEL;
|
||||
case e_ropeJoint:
|
||||
return JOINT_ROPE;
|
||||
case e_motorJoint:
|
||||
return JOINT_MOTOR;
|
||||
default:
|
||||
return JOINT_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
Body *Joint::getBodyA() const
|
||||
{
|
||||
b2Body *b2body = joint->GetBodyA();
|
||||
if (b2body == nullptr)
|
||||
return nullptr;
|
||||
|
||||
Body *body = (Body *) Memoizer::find(b2body);
|
||||
if (body == nullptr)
|
||||
throw love::Exception("A body has escaped Memoizer!");
|
||||
|
||||
return body;
|
||||
}
|
||||
|
||||
Body *Joint::getBodyB() const
|
||||
{
|
||||
b2Body *b2body = joint->GetBodyB();
|
||||
if (b2body == nullptr)
|
||||
return nullptr;
|
||||
|
||||
Body *body = (Body *) Memoizer::find(b2body);
|
||||
if (body == nullptr)
|
||||
throw love::Exception("A body has escaped Memoizer!");
|
||||
|
||||
return body;
|
||||
}
|
||||
|
||||
bool Joint::isValid() const
|
||||
{
|
||||
return joint != 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -79,12 +79,14 @@ public:
|
||||
**/
|
||||
bool isValid() const;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the type of joint.
|
||||
**/
|
||||
Type getType() const;
|
||||
|
||||
Body *getBodyA() const;
|
||||
Body *getBodyB() const;
|
||||
|
||||
/**
|
||||
* Gets the anchor positions of the Joint in world
|
||||
* coordinates. This is useful for debugdrawing the joint.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -93,6 +93,12 @@ EdgeShape *Physics::newEdgeShape(float x1, float y1, float x2, float y2)
|
||||
int Physics::newPolygonShape(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
|
||||
bool istable = lua_istable(L, 1);
|
||||
|
||||
if (istable)
|
||||
argc = lua_objlen(L, 1);
|
||||
|
||||
if (argc % 2 != 0)
|
||||
return luaL_error(L, "Number of vertex components must be a multiple of two.");
|
||||
|
||||
@@ -103,16 +109,31 @@ int Physics::newPolygonShape(lua_State *L)
|
||||
else if (vcount > b2_maxPolygonVertices)
|
||||
return luaL_error(L, "Expected a maximum of %d vertices, got %d.", b2_maxPolygonVertices, vcount);
|
||||
|
||||
b2PolygonShape *s = new b2PolygonShape();
|
||||
|
||||
b2Vec2 vecs[b2_maxPolygonVertices];
|
||||
|
||||
for (int i = 0; i < vcount; i++)
|
||||
if (istable)
|
||||
{
|
||||
float x = (float)luaL_checknumber(L, 1 + i * 2);
|
||||
float y = (float)luaL_checknumber(L, 2 + i * 2);
|
||||
vecs[i] = Physics::scaleDown(b2Vec2(x, y));
|
||||
for (int i = 0; i < vcount; i++)
|
||||
{
|
||||
lua_rawgeti(L, 1, 1 + i * 2);
|
||||
lua_rawgeti(L, 1, 2 + i * 2);
|
||||
float x = (float)luaL_checknumber(L, -2);
|
||||
float y = (float)luaL_checknumber(L, -1);
|
||||
vecs[i] = Physics::scaleDown(b2Vec2(x, y));
|
||||
lua_pop(L, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < vcount; i++)
|
||||
{
|
||||
float x = (float)luaL_checknumber(L, 1 + i * 2);
|
||||
float y = (float)luaL_checknumber(L, 2 + i * 2);
|
||||
vecs[i] = Physics::scaleDown(b2Vec2(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
b2PolygonShape *s = new b2PolygonShape();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -133,22 +154,42 @@ int Physics::newPolygonShape(lua_State *L)
|
||||
int Physics::newChainShape(lua_State *L)
|
||||
{
|
||||
int argc = lua_gettop(L)-1; // first argument is looping
|
||||
|
||||
bool istable = lua_istable(L, 2);
|
||||
|
||||
if (istable)
|
||||
argc = lua_objlen(L, 2);
|
||||
|
||||
if (argc % 2 != 0)
|
||||
return luaL_error(L, "Number of vertex components must be a multiple of two.");
|
||||
|
||||
int vcount = (int)argc/2;
|
||||
b2ChainShape *s = new b2ChainShape();
|
||||
bool loop = luax_toboolean(L, 1);
|
||||
b2Vec2 *vecs = new b2Vec2[vcount];
|
||||
|
||||
for (int i = 0; i<vcount; i++)
|
||||
if (istable)
|
||||
{
|
||||
float x = (float)lua_tonumber(L, -2);
|
||||
float y = (float)lua_tonumber(L, -1);
|
||||
vecs[i].Set(x, y);
|
||||
vecs[i] = Physics::scaleDown(vecs[i]);
|
||||
lua_pop(L, 2);
|
||||
for (int i = 0; i < vcount; i++)
|
||||
{
|
||||
lua_rawgeti(L, 2, 1 + i * 2);
|
||||
lua_rawgeti(L, 2, 2 + i * 2);
|
||||
float x = (float)lua_tonumber(L, -2);
|
||||
float y = (float)lua_tonumber(L, -1);
|
||||
vecs[i] = Physics::scaleDown(b2Vec2(x, y));
|
||||
lua_pop(L, 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < vcount; i++)
|
||||
{
|
||||
float x = (float)luaL_checknumber(L, 2 + i * 2);
|
||||
float y = (float)luaL_checknumber(L, 3 + i * 2);
|
||||
vecs[i] = Physics::scaleDown(b2Vec2(x, y));
|
||||
}
|
||||
}
|
||||
|
||||
b2ChainShape *s = new b2ChainShape();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -160,6 +201,7 @@ int Physics::newChainShape(lua_State *L)
|
||||
catch (love::Exception &)
|
||||
{
|
||||
delete[] vecs;
|
||||
delete s;
|
||||
throw;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -539,6 +539,15 @@ int w_Body_getFixtureList(lua_State *L)
|
||||
return n;
|
||||
}
|
||||
|
||||
int w_Body_getJointList(lua_State *L)
|
||||
{
|
||||
Body *t = luax_checkbody(L, 1);
|
||||
lua_remove(L, 1);
|
||||
int n = 0;
|
||||
luax_catchexcept(L, [&](){ n = t->getJointList(L); });
|
||||
return n;
|
||||
}
|
||||
|
||||
int w_Body_getContactList(lua_State *L)
|
||||
{
|
||||
Body *t = luax_checkbody(L, 1);
|
||||
@@ -555,6 +564,13 @@ int w_Body_destroy(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_Body_isDestroyed(lua_State *L)
|
||||
{
|
||||
Body *b = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
|
||||
luax_pushboolean(L, b->body == nullptr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Body_setUserData(lua_State *L)
|
||||
{
|
||||
Body *t = luax_checkbody(L, 1);
|
||||
@@ -623,8 +639,10 @@ static const luaL_Reg functions[] =
|
||||
{ "isFixedRotation", w_Body_isFixedRotation },
|
||||
{ "getWorld", w_Body_getWorld },
|
||||
{ "getFixtureList", w_Body_getFixtureList },
|
||||
{ "getJointList", w_Body_getJointList },
|
||||
{ "getContactList", w_Body_getContactList },
|
||||
{ "destroy", w_Body_destroy },
|
||||
{ "isDestroyed", w_Body_isDestroyed },
|
||||
{ "setUserData", w_Body_setUserData },
|
||||
{ "getUserData", w_Body_getUserData },
|
||||
{ 0, 0 }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -85,8 +85,10 @@ int w_Body_setFixedRotation(lua_State *L);
|
||||
int w_Body_isFixedRotation(lua_State *L);
|
||||
int w_Body_getWorld(lua_State *L);
|
||||
int w_Body_getFixtureList(lua_State *L);
|
||||
int w_Body_getJointList(lua_State *L);
|
||||
int w_Body_getContactList(lua_State *L);
|
||||
int w_Body_destroy(lua_State *L);
|
||||
int w_Body_isDestroyed(lua_State *L);
|
||||
int w_Body_setUserData(lua_State *L);
|
||||
int w_Body_getUserData(lua_State *L);
|
||||
extern "C" int luaopen_body(lua_State *L);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -151,6 +151,13 @@ int w_Contact_getFixtures(lua_State *L)
|
||||
return 2;
|
||||
}
|
||||
|
||||
int w_Contact_isDestroyed(lua_State *L)
|
||||
{
|
||||
Contact *c = luax_checktype<Contact>(L, 1, "Contact", PHYSICS_CONTACT_T);
|
||||
luax_pushboolean(L, !c->isValid());
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern "C" int luaopen_contact(lua_State *L)
|
||||
{
|
||||
static const luaL_Reg functions[] =
|
||||
@@ -170,6 +177,7 @@ extern "C" int luaopen_contact(lua_State *L)
|
||||
{ "getTangentSpeed", w_Contact_getTangentSpeed },
|
||||
{ "getChildren", w_Contact_getChildren },
|
||||
{ "getFixtures", w_Contact_getFixtures },
|
||||
{ "isDestroyed", w_Contact_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -48,6 +48,7 @@ int w_Contact_setTangentSpeed(lua_State *L);
|
||||
int w_Contact_getTangentSpeed(lua_State *L);
|
||||
int w_Contact_getChildren(lua_State *L);
|
||||
int w_Contact_getFixtures(lua_State *L);
|
||||
int w_Contact_isDestroyed(lua_State *L);
|
||||
extern "C" int luaopen_contact(lua_State *L);
|
||||
|
||||
} // box2d
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -90,6 +90,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getDampingRatio", w_DistanceJoint_getDampingRatio },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -97,6 +98,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -262,6 +262,13 @@ int w_Fixture_destroy(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_Fixture_isDestroyed(lua_State *L)
|
||||
{
|
||||
Fixture *f = luax_checktype<Fixture>(L, 1, "Fixture", PHYSICS_FIXTURE_T);
|
||||
luax_pushboolean(L, !f->isValid());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getType", w_Fixture_getType },
|
||||
@@ -290,6 +297,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getGroupIndex", w_Fixture_getGroupIndex },
|
||||
{ "setGroupIndex", w_Fixture_setGroupIndex },
|
||||
{ "destroy", w_Fixture_destroy },
|
||||
{ "isDestroyed", w_Fixture_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -60,6 +60,7 @@ int w_Fixture_getMassData(lua_State *L);
|
||||
int w_Fixture_getGroupIndex(lua_State *L);
|
||||
int w_Fixture_setGroupIndex(lua_State *L);
|
||||
int w_Fixture_destroy(lua_State *L);
|
||||
int w_Fixture_isDestroyed(lua_State *L);
|
||||
extern "C" int luaopen_fixture(lua_State *L);
|
||||
|
||||
} // box2d
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -74,6 +74,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getMaxTorque", w_FrictionJoint_getMaxTorque },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -81,6 +82,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -51,12 +51,30 @@ int w_GearJoint_getRatio(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_GearJoint_getJoints(lua_State *L)
|
||||
{
|
||||
GearJoint *t = luax_checkgearjoint(L, 1);
|
||||
Joint *j1 = nullptr;
|
||||
Joint *j2 = nullptr;
|
||||
|
||||
luax_catchexcept(L, [&]() {
|
||||
j1 = t->getJointA();
|
||||
j2 = t->getJointB();
|
||||
});
|
||||
|
||||
luax_pushjoint(L, j1);
|
||||
luax_pushjoint(L, j2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "setRatio", w_GearJoint_setRatio },
|
||||
{ "getRatio", w_GearJoint_getRatio },
|
||||
{ "getJoints", w_GearJoint_getJoints },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -64,6 +82,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -36,6 +36,7 @@ namespace box2d
|
||||
GearJoint *luax_checkgearjoint(lua_State *L, int idx);
|
||||
int w_GearJoint_setRatio(lua_State *L);
|
||||
int w_GearJoint_getRatio(lua_State *L);
|
||||
int w_GearJoint_getJoints(lua_State *L);
|
||||
extern "C" int luaopen_gearjoint(lua_State *L);
|
||||
|
||||
} // box2d
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -21,6 +21,7 @@
|
||||
// LOVE
|
||||
#include "wrap_Joint.h"
|
||||
#include "common/StringMap.h"
|
||||
#include "Body.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -29,6 +30,40 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
|
||||
void luax_pushjoint(lua_State *L, Joint *j)
|
||||
{
|
||||
if (j == nullptr)
|
||||
return lua_pushnil(L);
|
||||
|
||||
switch (j->getType())
|
||||
{
|
||||
case Joint::JOINT_DISTANCE:
|
||||
return luax_pushtype(L, "DistanceJoint", PHYSICS_DISTANCE_JOINT_T, j);
|
||||
case Joint::JOINT_REVOLUTE:
|
||||
return luax_pushtype(L, "RevoluteJoint", PHYSICS_REVOLUTE_JOINT_T, j);
|
||||
case Joint::JOINT_PRISMATIC:
|
||||
return luax_pushtype(L, "PrismaticJoint", PHYSICS_PRISMATIC_JOINT_T, j);
|
||||
case Joint::JOINT_MOUSE:
|
||||
return luax_pushtype(L, "MouseJoint", PHYSICS_MOUSE_JOINT_T, j);
|
||||
case Joint::JOINT_PULLEY:
|
||||
return luax_pushtype(L, "PulleyJoint", PHYSICS_PULLEY_JOINT_T, j);
|
||||
case Joint::JOINT_GEAR:
|
||||
return luax_pushtype(L, "GearJoint", PHYSICS_GEAR_JOINT_T, j);
|
||||
case Joint::JOINT_FRICTION:
|
||||
return luax_pushtype(L, "FrictionJoint", PHYSICS_FRICTION_JOINT_T, j);
|
||||
case Joint::JOINT_WELD:
|
||||
return luax_pushtype(L, "WeldJoint", PHYSICS_WELD_JOINT_T, j);
|
||||
case Joint::JOINT_WHEEL:
|
||||
return luax_pushtype(L, "WheelJoint", PHYSICS_WHEEL_JOINT_T, j);
|
||||
case Joint::JOINT_ROPE:
|
||||
return luax_pushtype(L, "RopeJoint", PHYSICS_ROPE_JOINT_T, j);
|
||||
case Joint::JOINT_MOTOR:
|
||||
return luax_pushtype(L, "MotorJoint", PHYSICS_MOTOR_JOINT_T, j);
|
||||
default:
|
||||
return lua_pushnil(L);
|
||||
}
|
||||
}
|
||||
|
||||
Joint *luax_checkjoint(lua_State *L, int idx)
|
||||
{
|
||||
Joint *t = luax_checktype<Joint>(L, idx, "Joint", PHYSICS_JOINT_T);
|
||||
@@ -46,6 +81,22 @@ int w_Joint_getType(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Joint_getBodies(lua_State *L)
|
||||
{
|
||||
Joint *t = luax_checkjoint(L, 1);
|
||||
Body *b1 = nullptr;
|
||||
Body *b2 = nullptr;
|
||||
|
||||
luax_catchexcept(L, [&]() {
|
||||
b1 = t->getBodyA();
|
||||
b2 = t->getBodyB();
|
||||
});
|
||||
|
||||
luax_pushtype(L, "Body", PHYSICS_BODY_T, b1);
|
||||
luax_pushtype(L, "Body", PHYSICS_BODY_T, b2);
|
||||
return 2;
|
||||
}
|
||||
|
||||
int w_Joint_getAnchors(lua_State *L)
|
||||
{
|
||||
Joint *t = luax_checkjoint(L, 1);
|
||||
@@ -96,9 +147,17 @@ int w_Joint_destroy(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_Joint_isDestroyed(lua_State *L)
|
||||
{
|
||||
Joint *t = luax_checktype<Joint>(L, 1, "Joint", PHYSICS_JOINT_T);
|
||||
luax_pushboolean(L, !t->isValid());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -106,6 +165,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -32,8 +32,10 @@ namespace physics
|
||||
namespace box2d
|
||||
{
|
||||
|
||||
void luax_pushjoint(lua_State *L, Joint *j);
|
||||
Joint *luax_checkjoint(lua_State *L, int idx);
|
||||
int w_Joint_getType(lua_State *L);
|
||||
int w_Joint_getBodies(lua_State *L);
|
||||
int w_Joint_getAnchors(lua_State *L);
|
||||
int w_Joint_getReactionForce(lua_State *L);
|
||||
int w_Joint_getReactionTorque(lua_State *L);
|
||||
@@ -41,6 +43,7 @@ int w_Joint_getCollideConnected(lua_State *L);
|
||||
int w_Joint_setUserData(lua_State *L);
|
||||
int w_Joint_getUserData(lua_State *L);
|
||||
int w_Joint_destroy(lua_State *L);
|
||||
int w_Joint_isDestroyed(lua_State *L);
|
||||
extern "C" int luaopen_joint(lua_State *L);
|
||||
|
||||
} // box2d
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -124,6 +124,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getCorrectionFactor", w_MotorJoint_getCorrectionFactor },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -131,6 +132,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -108,6 +108,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getDampingRatio", w_MouseJoint_getDampingRatio },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -115,6 +116,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -185,6 +185,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getLimits", w_PrismaticJoint_getLimits },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -192,6 +193,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -71,6 +71,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getRatio", w_PulleyJoint_getRatio },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -78,6 +79,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -185,6 +185,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getLimits", w_RevoluteJoint_getLimits },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -192,6 +193,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -47,6 +47,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getMaxLength", w_RopeJoint_getMaxLength },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -54,6 +55,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -73,6 +73,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getDampingRatio", w_WeldJoint_getDampingRatio },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -80,6 +81,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -149,6 +149,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getSpringDampingRatio", w_WheelJoint_getSpringDampingRatio },
|
||||
// From Joint.
|
||||
{ "getType", w_Joint_getType },
|
||||
{ "getBodies", w_Joint_getBodies },
|
||||
{ "getAnchors", w_Joint_getAnchors },
|
||||
{ "getReactionForce", w_Joint_getReactionForce },
|
||||
{ "getReactionTorque", w_Joint_getReactionTorque },
|
||||
@@ -156,6 +157,7 @@ static const luaL_Reg functions[] =
|
||||
{ "setUserData", w_Joint_setUserData },
|
||||
{ "getUserData", w_Joint_getUserData },
|
||||
{ "destroy", w_Joint_destroy },
|
||||
{ "isDestroyed", w_Joint_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -189,6 +189,13 @@ int w_World_destroy(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_World_isDestroyed(lua_State *L)
|
||||
{
|
||||
World *w = luax_checktype<World>(L, 1, "World", PHYSICS_WORLD_T);
|
||||
luax_pushboolean(L, !w->isValid());
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
@@ -212,6 +219,7 @@ static const luaL_Reg functions[] =
|
||||
{ "queryBoundingBox", w_World_queryBoundingBox },
|
||||
{ "rayCast", w_World_rayCast },
|
||||
{ "destroy", w_World_destroy },
|
||||
{ "isDestroyed", w_World_isDestroyed },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2014 LOVE Development Team
|
||||
* Copyright (c) 2006-2015 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
@@ -55,6 +55,7 @@ int w_World_getContactList(lua_State *L);
|
||||
int w_World_queryBoundingBox(lua_State *L);
|
||||
int w_World_rayCast(lua_State *L);
|
||||
int w_World_destroy(lua_State *L);
|
||||
int w_World_isDestroyed(lua_State *L);
|
||||
extern "C" int luaopen_world(lua_State *L);
|
||||
|
||||
} // box2d
|
||||
|
||||
Reference in New Issue
Block a user