So I'm trying to make a button but I can't resize and center the text because both getLocalBounds and getGlobalBounds are returning 0. Here is the code:
void Button::setString(sf::String string)
{
m_string = string;
m_text.setString(m_string);
std::cout << m_text.getGlobalBounds().width; //This returns 0
}
m_text is a private sf::Text variable.
The text is drawn on the screen, the setChar size method works as well. The only thing that isn't right here is that getGlobalBounds().width/height and getLocalBounds().width/height always return 0.