Commits

Bart van Strien  committed d4f520f

Add Contact:getChildren (pull request #15)

  • Participants
  • Parent commits 748d3e3

Comments (0)

Files changed (4)

File src/modules/physics/box2d/Contact.cpp

 	contact->ResetRestitution();
 }
 
+void Contact::getChildren(int &childA, int &childB)
+{
+	childA = contact->GetChildIndexA();
+	childB = contact->GetChildIndexB();
+}
+
 } // box2d
 } // physics
 } // love

File src/modules/physics/box2d/Contact.h

 	 **/
 	void resetRestitution();
 
+
+	void getChildren(int &childA, int &childB);
+
 private:
 
 	// The Box2D contact.

File src/modules/physics/box2d/wrap_Contact.cpp

 	return 0;
 }
 
+int w_Contact_getChildren(lua_State *L)
+{
+	Contact *t = luax_checkcontact(L, 1);
+	int a, b;
+	t->getChildren(a, b);
+	lua_pushnumber(L, a);
+	lua_pushnumber(L, b);
+	return 2;
+}
+
 extern "C" int luaopen_contact(lua_State *L)
 {
 	static const luaL_Reg functions[] =
 		{ "setEnabled", w_Contact_setEnabled },
 		{ "resetFriction", w_Contact_resetFriction },
 		{ "resetRestitution", w_Contact_resetRestitution },
+		{ "getChildren", w_Contact_getChildren },
 		{ 0, 0 }
 	};
 

File src/modules/physics/box2d/wrap_Contact.h

 int w_Contact_setEnabled(lua_State *L);
 int w_Contact_resetFriction(lua_State *L);
 int w_Contact_resetRestitution(lua_State *L);
+int w_Contact_getChildren(lua_State *L);
 extern "C" int luaopen_contact(lua_State *L);
 
 } // box2d