Paul Smith пре 13 година
родитељ
комит
535fb3965d

+ 1 - 1
Modules/Contents/2DPhysics/Include/PolyPhysicsScreen.h

@@ -85,7 +85,7 @@ class _PolyExport PhysicsScreenEvent : public Event {
 		*/			
 		Vector2 worldCollisionPoint;
 
-		/*
+		/**
          * Raw Box2d Contact
          */
     

+ 11 - 5
Modules/Contents/2DPhysics/Include/PolyPhysicsScreenEntity.h

@@ -99,13 +99,19 @@ namespace Polycode {
             void setCollisionMask(int maskBits);
         
             void setCollisionGroupIndex(int group);
-			
-			b2Fixture* getFixture();			// Gets the last fixture selected (automatically set on creation)			
-			b2Fixture* getFixture(unsigned short index);	// Gets a specific fixture if there is more than one
-            
+
+			/**
+			 * Gets a specific fixture via it's index position
+			 */
+			b2Fixture* getFixture(unsigned short index);
+			/**
+			 * Gets the last fixture selected (automatically set to last added on creation)
+			 */
+			b2Fixture* getFixture();
+
 			/**
 			* Rectangular physics entity
-			*/ 
+			*/
 			static const int ENTITY_RECT = 1;
 			/**
 			* Circular physics entity

+ 6 - 6
Modules/Contents/2DPhysics/Source/PolyPhysicsScreen.cpp

@@ -409,8 +409,8 @@ ScreenEntity *PhysicsScreen::getEntityAtPosition(Number x, Number y) {
 	for(int i=0;i<physicsChildren.size();i++) {
 		PhysicsScreenEntity *ent = physicsChildren[i];
 		if(ent->fixture) {
-			for (b2Fixture* f = ent->body->GetFixtureList(); f; f = f->GetNext()) {		// This has been changed to accept multiple fixtures
-				if(f->TestPoint(mousePosition)) {										// Fixtures have a Testpoint function that requires just a b2Vec
+			for (b2Fixture* f = ent->body->GetFixtureList(); f; f = f->GetNext()) {
+				if(f->TestPoint(mousePosition)) {
 					return ent->getScreenEntity();
 				}
 			}
@@ -430,8 +430,8 @@ bool PhysicsScreen::testEntityAtPosition(ScreenEntity *ent, Number x, Number y)
 	mousePosition.y = y/worldScale;
 	
 	if(pEnt->fixture) {
-		for (b2Fixture* f = pEnt->body->GetFixtureList(); f; f = f->GetNext()) {	// This has been changed to accept multiple fixtures
-			if(f->TestPoint(mousePosition))											// Fixtures have a Testpoint function that requires just a b2Vec
+		for (b2Fixture* f = pEnt->body->GetFixtureList(); f; f = f->GetNext()) {
+			if(f->TestPoint(mousePosition))
 				return true;
 			else
 				return false;
@@ -493,7 +493,7 @@ PhysicsScreen::~PhysicsScreen() {
 	delete world;	
 }
 
-PhysicsScreenEntity *PhysicsScreen::getPhysicsEntityByFixture(b2Fixture *fixture) {			// I have made changes so it will search through body fixturelists
+PhysicsScreenEntity *PhysicsScreen::getPhysicsEntityByFixture(b2Fixture *fixture) {
 	for(int i=0; i < physicsChildren.size(); i++) {											
 		for (b2Fixture* f = physicsChildren[i]->body->GetFixtureList(); f; f = f->GetNext()) {
 			if(f == fixture)
@@ -503,7 +503,7 @@ PhysicsScreenEntity *PhysicsScreen::getPhysicsEntityByFixture(b2Fixture *fixture
 	return NULL;	
 }
 
-PhysicsScreenEntity *PhysicsScreen::getPhysicsEntityByShape(b2Shape *shape) {				// I have made changes so it will search through body fixturelists
+PhysicsScreenEntity *PhysicsScreen::getPhysicsEntityByShape(b2Shape *shape) {
 	for(int i=0; i < physicsChildren.size(); i++) {
 		for (b2Fixture *f = physicsChildren[i]->body->GetFixtureList(); f; f = f->GetNext()) {
 			if(f->GetShape() == shape)

+ 1 - 15
Modules/Contents/2DPhysics/Source/PolyPhysicsScreenEntity.cpp

@@ -265,18 +265,6 @@ void PhysicsScreenEntity::Update() {
 	}	
 }
 
-
-
-//==============================================
-//Add on functions to access the fixture library
-//==============================================
-
-
-// Gets the last fixture selected
-b2Fixture* PhysicsScreenEntity::getFixture() { return fixture; }
-
-
-// Returns specific fixture based on index starting from 0
 b2Fixture* PhysicsScreenEntity::getFixture(unsigned short index) {
 	if(fixture)	{
 		short i = 0;
@@ -296,14 +284,12 @@ b2Fixture* PhysicsScreenEntity::getFixture(unsigned short index) {
 	return fixture = NULL;	
 }
 
+b2Fixture* PhysicsScreenEntity::getFixture() { return fixture; }
 
 
 // I believe that at runtime you are not supposed to edit Shapes; However you still can
 // by getting a fixture(above) and then adding "->GetShape()" on the end to get the fixtures shape
 
-
-
-// Slight change to the destructor
 PhysicsScreenEntity::~PhysicsScreenEntity()
 {
 	if(body)