I'm having problems.
here is the class that extend Drawable:
class TileMenu : public sf::Drawable{
private:
sf::Sprite monitor;
sf::Text residents;
sf::Text workers;
sf::Text energy;
sf::Text money;
sf::Text pollution;
sf::Text happiness;
sf::Text food;
sf::Text goods;
sf::Font font;
sf::FloatRect close;
public:
TileMenu(Tile& tile, TextureManager& txm);
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
};
and here is the implementation of draw, which i honestly don't know if it is right:
void TileMenu::draw(sf::RenderTarget &target, sf::RenderStates states) const {
target.draw(monitor, states);
target.draw(residents, states);
target.draw(workers, states);
target.draw(energy, states);
target.draw(pollution, states);
target.draw(money, states);
target.draw(happiness, states);
target.draw(goods, states);
target.draw(food, states);
}
in the gameloop class i create a pointer TileMenu* tileMenu and i initialise it as nullptr.
Then i handle the vent of click in a tile and i create in that moment a new TileMenu passing the parameters it needs.
If i call:
renderWindow.draw(*tileMenu);
the program run, but the TileMenu is not shown.
where is the problem?