Added ChainShape:getNext/PreviousVertex (see issue #1191). Thanks airstruck!

This commit is contained in:
Alex Szpakowski
2016-07-31 14:25:12 -03:00
parent 55cb2fad84
commit 3157e5df7b
3 changed files with 80 additions and 0 deletions
+26
View File
@@ -67,6 +67,32 @@ void ChainShape::setPreviousVertex(float x, float y)
c->SetPrevVertex(Physics::scaleDown(v));
}
bool ChainShape::hasNextVertex() const
{
b2ChainShape *c = (b2ChainShape *)shape;
return c->m_hasNextVertex;
}
bool ChainShape::hasPreviousVertex() const
{
b2ChainShape *c = (b2ChainShape *)shape;
return c->m_hasPrevVertex;
}
b2Vec2 ChainShape::getNextVertex() const
{
b2ChainShape *c = (b2ChainShape *)shape;
const b2Vec2 &v = c->m_nextVertex;
return Physics::scaleUp(v);
}
b2Vec2 ChainShape::getPreviousVertex() const
{
b2ChainShape *c = (b2ChainShape *)shape;
const b2Vec2 &v = c->m_prevVertex;
return Physics::scaleUp(v);
}
EdgeShape *ChainShape::getChildEdge(int index) const
{
b2ChainShape *c = (b2ChainShape *)shape;