Hello,
I've been going through some of the tutorials on SFML, and everything has been working until I got to text and fonts. When I try to run my program, I get the following error:
"Unhandled exception at 0x70e71f34 in fonttest.exe: 0xC0000005: Access violation reading location 0x00331000."
This is what my code looks like:
#include <SFML/Graphics.hpp>
#include <iostream>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "Text test");
sf::Font font;
if(!font.loadFromFile("arial.ttf"))
std::cout << "font not loaded" << std::endl;
sf::Text text("hello, world", font, 16);
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;
}
I've tried putting my font file in the same folder as the executable and in the same folder as the source code, but I still get the same error.
The error occurs at the line
if(!font.loadFromFile("arial.ttf"))
I'm using SFML 2.3.2 with Visual Studio 2010