At first, an error would pop up in the console window saying that the font file couldn't be found (with a run time error), but now I'm just getting run time errors: Unhandled exception at 0x757b9617 in sfml-test.exe: Microsoft C++ exception: std::length_error at memory location 0x0031f3f0..
My code looks like this: #include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::Font MyFont;
MyFont.LoadFromFile("arial.ttf");
sf::RenderWindow App(sf::VideoMode(800,600,32), "test");
sf::Event Event;
sf::Shape box = sf::Shape::Rectangle(0, 0, 50, 50, sf::Color(100, 100, 100));
box.SetPosition(100,100);
while(App.IsOpened())
{
while(App.GetEvent(Event))
{
if(Event.Type == Event.Closed) App.Close();
}
App.Clear(sf::Color(100, 149, 237));
App.Draw(box);
App.Display();
}
return EXIT_SUCCESS;
}
How can I fix this?
EDIT: If I use if (!MyFont.Load...) return EXIT_SUCCESS;, the same thing. I'm not sure what's going wrong. I put arial.ttf in the same directory as the executable, the libraries, etc... I even put it in the resource folder in the project and it doesn't work.