mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-14 13:56:01 +00:00
Merge pull request #656 from noshbar/vs2017-fix
Physac.h fix for variable array size declaration.
This commit is contained in:
@@ -606,7 +606,7 @@ PHYSACDEF void PhysicsShatter(PhysicsBody body, Vector2 position, float force)
|
|||||||
{
|
{
|
||||||
int count = vertexData.vertexCount;
|
int count = vertexData.vertexCount;
|
||||||
Vector2 bodyPos = body->position;
|
Vector2 bodyPos = body->position;
|
||||||
Vector2 vertices[count];
|
Vector2 *vertices = (Vector2*)malloc(sizeof(Vector2) * count);
|
||||||
Mat2 trans = body->shape.transform;
|
Mat2 trans = body->shape.transform;
|
||||||
for (int i = 0; i < count; i++) vertices[i] = vertexData.positions[i];
|
for (int i = 0; i < count; i++) vertices[i] = vertexData.positions[i];
|
||||||
|
|
||||||
@@ -698,6 +698,8 @@ PHYSACDEF void PhysicsShatter(PhysicsBody body, Vector2 position, float force)
|
|||||||
// Apply force to new physics body
|
// Apply force to new physics body
|
||||||
PhysicsAddForce(newBody, forceDirection);
|
PhysicsAddForce(newBody, forceDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(vertices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user