Centering text on the screen with SFML
sf::Text::getLocalBounds()
has non-zero values for the top
and left
fields, so you can't ignore them when centering the origin.
Try this instead:
//center text
sf::FloatRect textRect = text.getLocalBounds();
text.setOrigin(textRect.left + textRect.width/2.0f,
textRect.top + textRect.height/2.0f);
text.setPosition(sf::Vector2f(SCRWIDTH/2.0f,SCRHEIGHT/2.0f));
I think this is a know problem with SFML's text rendering. Head on over to their issue tracker and take a look at this issue.
Also you could ask at their development forum. The developers their are always very friendly and helpful.