Hi, sorry for posting again so quickly, but I'm having an issue with multiple inheritance of
sf::RectangleShape and
sf::Text.
The reason I'm doing this is because I need to implement textboxes and I'd prefer to use inheritance over encapsulation (in which case the rectangle and text would be separate private objects) since i have also used inheritance for my player, NPCs and tile maps. However, when I try to draw this, I get the following error:
‘sf::Drawable’ is an ambiguous base of ‘Textbox’
Here is my
Textbox constructor (where i also draw the textbox) in case you need it.
Textbox::Textbox(sf::Vector2f position, sf::Vector2f dimensions, std::vector<std::string> text, sf::RenderWindow& window)
{
RectangleShape::setPosition(position);
Text::setPosition(position.x + 3, position.y + 6);
if (!font.loadFromFile("assets/DeterminationMono.ttf"))
exit(1);
Text::setFont(font);
for (std::string i : text)
{
Text::setString(i);
window.draw(*this);
}
}
Once again, it's pretty late at night here, so I may respond in some hours