Hello,
i tried to do special sprite, a kind of textured polygon sprite.
the sprite is displayed correctly, but after removed the child sprite, when cocos release the sprite, the app crash when i want destroy the vertices and indices.
here the constructor / destructor :
Some times, the destroy of the array of the vertices is ok and crash when trying to destroy the indices
static SpritePath* create(std::string vSpriteName, CubicSplineTime *vSpline, float vThickNess, int vCountPoints = 10)
{
SpritePath *res = 0;
if (vSpriteName.size() > 0 && vSpline != 0 && vThickNess > 0.0f && vCountPoints > 1)
{
if (vSpline->GetPoints().size() > 1)
{
res = new SpritePath(vSpriteName, vSpline, vThickNess, vCountPoints);
if (res != 0 && res->init())
{
res->autorelease();
}
else
{
CC_SAFE_DELETE(res);
res = 0;
}
}
}
return res;
}
SpritePath(std::string vSpriteName, CubicSplineTime *vSpline, float vThickNess, int vCountPoints)
: cocos2d::Sprite(), m_SpriteName(vSpriteName), m_Spline(vSpline), m_CountPoints(vCountPoints),
m_ThickNess(vThickNess)
{
m_Triangles.verts = 0;
m_Triangles.vertCount = 0;
m_Triangles.indices = 0;
m_Triangles.indexCount = 0;
}
~SpritePath()
{
CC_SAFE_DELETE_ARRAY(m_Triangles.verts);
CC_SAFE_DELETE_ARRAY(m_Triangles.indices);
}
i tried before that with the new PolygonInfo but it was the same issue.
and the error message is that :
do you have any ideas of wat is the cause ?
please help me