31
Graphics / Re: How about getting the Font in xCode 5?
« on: June 01, 2014, 07:25:18 am »
From what I can gather, resourcepath was supposed to be your file path that would be loaded into your font. I also noticed you're mentioning two different files, BoxFont.ttf and sansation.ttf . Make sure you load the correct file name first off, secondly you could check if the font loaded correctly:
and then from there add the font to a sf::text and write
if (!font.loadFromFile("BoxFont.ttf"))
{
// error...
}
{
// error...
}
and then from there add the font to a sf::text and write
sf::Text text;
text.setFont(font);
text.setString("Hello world");
text.setCharacterSize(24); // in pixels
text.setColor(sf::Color::Red);
text.setStyle(sf::Text::Bold | sf::Text::Underlined);
...
// inside the main loop, between window.clear() and window.display()
window.draw(text);
text.setFont(font);
text.setString("Hello world");
text.setCharacterSize(24); // in pixels
text.setColor(sf::Color::Red);
text.setStyle(sf::Text::Bold | sf::Text::Underlined);
...
// inside the main loop, between window.clear() and window.display()
window.draw(text);