I am working on a game and am planning on creating a text management class that will basically place text anywhere on the screen. I am trying to use a class member variable of sfml type as a parameter and I can figure out how to make it work. below is a few snippets of code.
text manager class function
void TextManager::SetUpText(sf::Text text, sf::FloatRect text_rect, sf::Color color, std::string word, int size, sf::Font, float width, float height)
{
text.setString(word);
text.setFillColor(color);
text.setCharacterSize(size);
text_rect = text.getLocalBounds();
text.setOrigin(text_rect.left + text_rect.width / 2.0f,
text_rect.top + text_rect.height / 2.0f);
text.setPosition(sf::Vector2f(width / 2.0f, height / 4.0f));
}
I'm trying to use this function in one of my title screen class functions, but the parameters I'm entering aren't working.
these are the title screen member variables I'm trying to use
sf::Font start_Font;
sf::Text start_Title_Text;
sf::FloatRect start_Title_TextRect;
I'm trying to use them in the function from the text manager class
here is the function in the title screen class
void StartScreen::SetUpScreen(int width, int height)
{
start_BACKGROUND.loadFromFile("Background.png");
start_Font.loadFromFile("Title.ttf");
start_Title_Text.setFont(start_Font);
SetUpText(start_Title_Text, start_Title_TextRect, sf::Color::White, "Title", 72, start_Font, width, height);
}
but the start_Title_Text, start_Title_TextRect and start_Font are all saying
"no suitable user-defined conversion from sf::type" to "TitleScreen" exists"