Просмотр исходного кода

Box2D's PostSolve callback now dispatches EVENT_SOLVE_SHAPE_COLLISION instead of EVENT_NEW_SHAPE_COLLISION, reset yesNoCancel dialog action in IDE

Ivan Safrin 12 лет назад
Родитель
Сommit
a2ed1507b3

+ 2 - 2
Examples/C++/Contents/2DPhysics_Contacts/HelloPolycodeApp.cpp

@@ -20,13 +20,13 @@ HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) : EventHandler() {
 		screen->addPhysicsChild(shape, PhysicsScreenEntity::ENTITY_RECT, false);		
 	}
 	collisionSound = new Sound("Resources/hit.wav");
-	screen->addEventListener(this, PhysicsScreenEvent::EVENT_NEW_SHAPE_COLLISION);
+	screen->addEventListener(this, PhysicsScreenEvent::EVENT_SOLVE_SHAPE_COLLISION);
 }
 
 void HelloPolycodeApp::handleEvent(Event *e) {
 	if(e->getDispatcher() == screen) {
 		switch(e->getEventCode()) {
-			case PhysicsScreenEvent::EVENT_NEW_SHAPE_COLLISION:
+			case PhysicsScreenEvent::EVENT_SOLVE_SHAPE_COLLISION:
 				PhysicsScreenEvent *pe = (PhysicsScreenEvent*)e;
 				if(pe->impactStrength > 5)
 					collisionSound->Play();

+ 2 - 2
Examples/Lua/2D_Physics/2DPhysics_Contacts/Scripts/2DPhysics_Contacts.lua

@@ -16,11 +16,11 @@ end
 
 collisionSound = Sound("Resources/collision.wav")
 
-function onCollision(t, event)
+function onSolveCollision(t, event)
 	physicsEvent = safe_cast(event, PhysicsScreenEvent)
 	if physicsEvent.impactStrength > 5 then
 			collisionSound:Play()
 		end
 end
 
-screen:addEventListener(test, onCollision, PhysicsScreenEvent.EVENT_NEW_SHAPE_COLLISION)
+screen:addEventListener(test, onSolveCollision, PhysicsScreenEvent.EVENT_SOLVE_SHAPE_COLLISION)

+ 2 - 0
IDE/Contents/Source/PolycodeIDEApp.cpp

@@ -597,6 +597,7 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 						editor->saveFile();
 						closeFile();
 					}
+					frame->yesNoCancelPopup->action = "";
 					frame->hideModal();					
 				}
 				break;
@@ -607,6 +608,7 @@ void PolycodeIDEApp::handleEvent(Event *event) {
 						editor->setHasChanges(false);
 						closeFile();
 					}
+					frame->yesNoCancelPopup->action = "";					
 					frame->hideModal();
 				}
 				break;

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

@@ -138,7 +138,7 @@ void PhysicsScreen::PostSolve(b2Contact* contact, const b2ContactImpulse* impuls
 			newEvent->frictionStrength = impulse->tangentImpulses[i];		
 	}
 
-	dispatchEvent(newEvent, PhysicsScreenEvent::EVENT_NEW_SHAPE_COLLISION);
+	dispatchEvent(newEvent, PhysicsScreenEvent::EVENT_SOLVE_SHAPE_COLLISION);
 }
 
 void PhysicsScreen::EndContact (b2Contact *contact) {