Hello everyone! I've been using SFML for a few days, and when reading the tutorial about sprites, I came across this code snippet:
class MyPicture
{
public :
// This is the copy constructor
MyPicture(const MyPicture& Copy) : Image(Copy.Image), Sprite(Copy.Sprite)
{
// This is the trick : we setup the sprite
// to use our image, instead of the one of Copy
Sprite.SetImage(Image);
}
// ... a lot of useful functions ...
private :
sf::Image Image;
sf::Sprite Sprite;
};
The problem is just that I have no idea how to use it, and the tutorial doesn't explain it very well. I'm not too good with classes either, but I know how to use them. Any help would be greatly appreciated. I would also really appreciate if someone could post an example code using this copy constructor. Maybe that would help me understand it a little bit more. Thanks.