MCPcopy Create free account
hub / github.com/axmolengine/axmol / changeBodyCallback

Method changeBodyCallback

tests/cpp-tests/Source/PhysicsTest/PhysicsTest.cpp:1738–1760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1736}
1737
1738void PhysicsDemoBug5482::changeBodyCallback(Object* /*sender*/)
1739{
1740 Sprite* node = _bodyInA ? _nodeB : _nodeA;
1741 if (_bodyInA)
1742 {
1743 _button->setString("Set Body To A");
1744 }
1745 else
1746 {
1747 _button->setString("Set Body To B");
1748 }
1749
1750 if (_body->getOwner())
1751 {
1752 _body->getOwner()->removeComponent(_body);
1753 }
1754
1755 // very important to have always _body and sprite in sync (Fix: #712)
1756 node->setRotation(AX_DEGREES_TO_RADIANS(_body->getRotation()));
1757
1758 node->addComponent(_body);
1759 _bodyInA = !_bodyInA;
1760}
1761
1762std::string PhysicsDemoBug5482::title() const
1763{

Callers

nothing calls this directly

Calls 6

removeComponentMethod · 0.80
addComponentMethod · 0.80
setStringMethod · 0.45
getOwnerMethod · 0.45
setRotationMethod · 0.45
getRotationMethod · 0.45

Tested by

no test coverage detected