Hi Forum,
i faced a problem with my inherited class and sf::sprite.
I have a custom class, that inherits from sf::Drawable and sf::Transformable
Here it is:
class DrawableObject : public sf::Drawable,public sf::Transformable
{
public:
DrawableObject();
~DrawableObject();
bool loadImage(std::string);
sf::FloatRect getFloatRect();
private:
sf::Texture m_texture;
sf::Sprite m_sprite;
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const
{
states.transform *= getTransform();
target.draw(m_sprite, states);
}
};
It works quite fine...i can render and move as expected !
But now i wanted to implement collision. I read that sf::transformable has no getGlobalBounds() function so
i thought that i just use the getGlobalBounds method from my sprite(m_sprite), but every value from the position to the FloatRect is nonsense(doesnt fit the values directly obtained from my class) !
Is there a way i can apply every tranformation i made to the class also to the Sprite ?
Thanks