SFML community forums
Help => General => Topic started by: prchakal on February 26, 2011, 05:10:15 am
-
Hi,
When i use SFML 1.6, i use the following code to write text to screen:
sf::String textBullets( "Bullets: " + StringConverter::toString(GameObjects::bullets->size()) );
textBullets.SetPosition(5, 25);
textBullets.SetSize(13);
App.Draw(textBullets);
But i get error when use SFML2, the methods SetPosition doesnt exists and Add.Draw doesnt work with sf::String.
What i need do?
And how to use custom fonts?
-
its been renamed, all you need to change is,
sf::String to sf::Text,
and change .SetSize to .SetCharacterSize,
and it should work as expected
-
And aboout custom fonts?
-
sf::Font font;
sf::Text text;
if(!font.LoadFromFile("verdana.ttf")){
//error
}
text.SetFont(font);
All about text:
http://www.sfml-dev.org/documentation/2.0/classsf_1_1Text.htm