Hi,
I am trying to display some text on my SFML window, but as the title says, there is an error with loadFromFile. I'm trying to load a font from my project directory. I checked, it's actually the working directory. Despite that, the load fails every time.
I would appreciate the help while I am still trying to figure this out.
#include <Windows.h>
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::Font font;
sf::Text text;
if(!font.loadFromFile("arial.tff")) {
OutputDebugStringA("ERR0R\n");
}
text.setFont(font);
text.setString("Success");
text.setCharacterSize(20);
text.setColor(sf::Color::White);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(text);
window.display();
}
return 0;
}
Thank you for your help,
PyZilla