Hello,
i got the following class:
class abc
:public sf::drawable,public error
{
public:
//something
void draw(blabla)const;
}
as you can see the class abc inheris from sf::drawable and error. The class error does not have a draw function(and it's no class that should be drawn, it just does some errormanagement), but when i inherit from the error class, abc stops getting drawn(which it correctly is, if i do not inherit from the error class).
So what do i do to change this? Does my error class have to inherit from sf::drawable as well? oO
Hmm, guess i should just add that error class as a member instead of inheriting...
It has to be something in your code, because the following minimal example works fine with me...
#include <SFML/Graphics.hpp>
class Foo
{
public:
Foo() {}
};
class Bar : public sf::Drawable, public Foo
{
public:
Bar() : Drawable(), Foo(), mRect(sf::Vector2f(10, 10)) {}
void draw(sf::RenderTarget &target, sf::RenderStates states) const { target.draw(mRect, states); }
private:
sf::RectangleShape mRect;
};
int main()
{
sf::RenderWindow window(sf::VideoMode(1024, 768), "Hello");
Bar test;
while(window.isOpen())
{
test.draw(window, sf::RenderStates::Default);
window.display();
}
return 0;
}