Run-Time Check Failure #2 - Stack around the variable 'font' was corrupted.
I don't get why my code is wrong, and I don't know what this means, any help?
int main()
{
RenderWindow window(VideoMode(800,600), "SFML Game");
window.setFramerateLimit(60);
bool play = true;
Event event;
bool titleDisplay = true;
Font font;
if (font.loadFromFile("Data/arial.ttf") == 0) {
return 1;
}
Text titleText;
titleText.setFont(font);
titleText.setCharacterSize(20);
titleText.setColor(Color::Green);
titleText.setPosition(240, 520);
titleText.setString("hi");
while(play == true){
while (window.pollEvent(event)){
if (event.type == Event::Closed) {
play = false;
}
if (Keyboard::isKeyPressed(Keyboard::Escape)) {
play = false;
}
}
Character.move();
window.clear();
window.draw(Character.mainRect);
if (titleDisplay == true) {
window.draw(titleText);
}
window.display();
}
window.close();
return 0;
}