SFML community forums
Help => Graphics => Topic started by: KevinZ on December 30, 2010, 04:23:26 am
-
I have created a class derived from Sprite, but when I try to draw an object from this class a white rectangle is drawn instead of the image.
This for example, when I use this class it renders a white rectangle, but when I directly use sf::Sprite it shows the image fine.
#include <SFML/Graphics.hpp>
class SDerived : public sf::Sprite
{
public:
SDerived(sf::Image SDImg) : sf::Sprite(SDImg){}
};
Could someone tell me why this doesn't work?
Thanks.
-
Hello, try passing the sf::Image by reference:
SDerived(sf::Image &img) : sf::Sprite(img)
-
Thanks! That did the trick.