PDA

View Full Version : possibly bug in CL_Sprite and CL_CollisionOutline



nemcheg
06-20-2010, 06:17 PM
hi,

seems that there is something wrong with copying/cloning in ClanLib...

i have a class containing CL_Sprite and CL_CollisionOutline,something like

class MySprite
{
...
CL_Sprite sprite;
CL_CollisionOutline collider;
};

and a copy constructor which allows to create another class instance using the same sprite and collision data:

MySprite::MySprite(MySprite &obj)
{
sprite.clone(obj.sprite);

collider = CL_CollisionOutline(obj.collider);
}

Here's at least 2 problems.

1 - CL_Sprite::clone() just dies with an exception (every time).
2 - copy constructor of CL_CollisionOutline does not actually create a functional copy of the object - even after all the forced recalculation and set_translation() etc. of a collider's copy, it does not work as it should (collision info does not even getting painted on the screen).

Are there really issues or i'm doing something wrongly?