So i have my function that puts an object into the center of the screen.
object.setPosition(width,height);
sf::FloatRect shapeRectangle = object.getLocalBounds();
object.setOrigin(shapeRectangle.left + shapeRectangle.width/2.0f,
shapeRectangle.top + shapeRectangle.height/2.0f);
The function is called twice once for an sf::RectangleShape and another for a sf::Text that should appear inside the sf::RectangleShape. This works great if I call the function above
after i have called sf::Texts function setString().
However if i put the object in the center of the screen and then call setString() or if setString(" "). Then the text that i put in using setString() is slightly offset. It goes up and to the right instead of the center of the sf::RectangleShape.
Not really sure how to solve this. :<