Hi!
I've made a simple function in SFML 2.0 to write some text on screen:
sf::Text txt(char* text, int size, sf::Color color, int x, int y)
{
sf::Text txt;
txt.setFont(font);
txt.setString(text);
txt.setCharacterSize(size);
txt.setColor(color);
txt.setPosition(x, y);
return txt;
}
Of course it's displayed this way:
window.draw(txt("text", 12, sf::Color::White, 0, 0));
It's causing program to crash while it's closing:
Unhandled exception at 0x76fb59a6 in Offensive.exe: 0xC0000005: Access violation reading location 0xfeeefef6.
I know that I made a stupid mistake
Please help me