Browse Source

Exposed shape:getBody

Bart van Strien 15 years ago
parent
commit
310a50ba2f

+ 2 - 1
changes.txt

@@ -17,7 +17,8 @@ LOVE 0.7.0
   * Fixed setFixedRotation enabling other flags.
   * Fixed setFixedRotation enabling other flags.
   * Fixed a bug in the loader (for require).
   * Fixed a bug in the loader (for require).
   * Fixed a bug where ParticleSystem::setSprite did not retain the new image.
   * Fixed a bug where ParticleSystem::setSprite did not retain the new image.
-  * Fixed a bug where images would lose their settings (wrapping, filters) when setMode as called.
+  * Fixed a bug where images would lose their settings (wrapping, filters) when setMode as called.
+  * Fixed a bug where shape:getBody wasn't exposed.
   * Invalid FSAA values now fall back to working ones (or none at all).
   * Invalid FSAA values now fall back to working ones (or none at all).
   * Cleaned up traceback in error screen.
   * Cleaned up traceback in error screen.
   * Moved fonts to love.font (from love.graphics), only rendering remains in love.graphics.
   * Moved fonts to love.font (from love.graphics), only rendering remains in love.graphics.

+ 1 - 3
src/modules/physics/box2d/Shape.h

@@ -23,6 +23,7 @@
 
 
 // LOVE
 // LOVE
 #include <physics/Shape.h>
 #include <physics/Shape.h>
+#include <physics/box2d/Body.h>
 #include <common/Reference.h>
 #include <common/Reference.h>
 
 
 // Box2D
 // Box2D
@@ -34,9 +35,6 @@ namespace physics
 {
 {
 namespace box2d
 namespace box2d
 {
 {
-	// Forward declarations.
-	class Body;
-
 	/**
 	/**
 	* This struct is stored in a void pointer
 	* This struct is stored in a void pointer
 	* in the Box2D Shape class. For now, all we
 	* in the Box2D Shape class. For now, all we

+ 1 - 0
src/modules/physics/box2d/wrap_CircleShape.cpp

@@ -71,6 +71,7 @@ namespace box2d
 		{ "getFriction", w_Shape_getFriction },
 		{ "getFriction", w_Shape_getFriction },
 		{ "getRestitution", w_Shape_getRestitution },
 		{ "getRestitution", w_Shape_getRestitution },
 		{ "getDensity", w_Shape_getDensity },
 		{ "getDensity", w_Shape_getDensity },
+		{ "getBody", w_Shape_getBody },
 		{ "isSensor", w_Shape_isSensor },
 		{ "isSensor", w_Shape_isSensor },
 		{ "testPoint", w_Shape_testPoint },
 		{ "testPoint", w_Shape_testPoint },
 		{ "testSegment", w_Shape_testSegment },
 		{ "testSegment", w_Shape_testSegment },

+ 1 - 0
src/modules/physics/box2d/wrap_PolygonShape.cpp

@@ -49,6 +49,7 @@ namespace box2d
 		{ "getFriction", w_Shape_getFriction },
 		{ "getFriction", w_Shape_getFriction },
 		{ "getRestitution", w_Shape_getRestitution },
 		{ "getRestitution", w_Shape_getRestitution },
 		{ "getDensity", w_Shape_getDensity },
 		{ "getDensity", w_Shape_getDensity },
+		{ "getBody", w_Shape_getBody },
 		{ "isSensor", w_Shape_isSensor },
 		{ "isSensor", w_Shape_isSensor },
 		{ "testPoint", w_Shape_testPoint },
 		{ "testPoint", w_Shape_testPoint },
 		{ "testSegment", w_Shape_testSegment },
 		{ "testSegment", w_Shape_testSegment },

+ 2 - 0
src/modules/physics/box2d/wrap_Shape.cpp

@@ -107,6 +107,7 @@ namespace box2d
 		Body * body = t->getBody();
 		Body * body = t->getBody();
 		if(body == 0)
 		if(body == 0)
 			return 0;
 			return 0;
+		body->retain();
 		luax_newtype(L, "Body", PHYSICS_BODY_T, (void*)body);
 		luax_newtype(L, "Body", PHYSICS_BODY_T, (void*)body);
 		return 1;
 		return 1;
 	}
 	}
@@ -233,6 +234,7 @@ namespace box2d
 		{ "getFriction", w_Shape_getFriction },
 		{ "getFriction", w_Shape_getFriction },
 		{ "getRestitution", w_Shape_getRestitution },
 		{ "getRestitution", w_Shape_getRestitution },
 		{ "getDensity", w_Shape_getDensity },
 		{ "getDensity", w_Shape_getDensity },
+		{ "getBody", w_Shape_getBody },
 		{ "isSensor", w_Shape_isSensor },
 		{ "isSensor", w_Shape_isSensor },
 		{ "testPoint", w_Shape_testPoint },
 		{ "testPoint", w_Shape_testPoint },
 		{ "testSegment", w_Shape_testSegment },
 		{ "testSegment", w_Shape_testSegment },