Hi, Iv got this source code and when i close my window the program breaks and writes this error. There is so many people with this problem on net, but im bigginer and i realy dont know whats wrong.
thx.
#include <SFML/Graphics.hpp>
#include <windows.h>
#include <iostream>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 650), "My window");
//----------------
sf::Font font;
if (!font.loadFromFile("arial.ttf"))
return 1;
sf::Text text;
text.setFont(font); // font is a sf::Font
text.setString("Hello world");// set the string to display
text.setCharacterSize(24); // in pixels, not points!
text.setColor(sf::Color::Red);
text.setStyle(sf::Text::Bold | sf::Text::Underlined);
text.setPosition(sf::Vector2f(500, 430));
//----------------
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::Black);
//------------------
window.draw(text);
//------------------
window.display();
}
return 0;
}