SFML community forums
Help => Graphics => Topic started by: DevBug on December 20, 2010, 11:58:17 pm
-
I'm having problems with SFML 2.0's sf::Text class. It seems that the text position is off. It seems to be a problem with the sf::Text class because the rectangle (where the text should be) draws fine. The positioning error only shows up when my position (x, y) are not a 1:1 ratio.
(http://anyhub.net/file/1dbV-fail.png)
// Inside my gui component
GetRenderer()->DrawText(GetCaption(), Gum::Base::Point(GetGlobalPos().x, GetGlobalPos().y));
// My renderer
void SFMLRenderer::DrawText(std::string& text, Point& position) {
Gum::Base::Size size = MeasureText(text);
sf::Text sfText = sf::Text(text, m_Font, 10);
sfText.SetPosition(sf::Vector2f((int)position.x, (int)position.y));
DrawRectangle(Gum::Base::Rect(position.x, position.y, size.w, size.h));
m_pTarget->Draw(sfText);
}
-
Could you please give a minimal and complete code that reproduces this bug? If it's just a positionning problem it should hard to do ;)
-
Topic locked, information about this bug are gathered in this other similar topic:
http://www.sfml-dev.org/forum/viewtopic.php?t=3798