I have a class that has Text and Font variables:
using namespace sf;
class MyClass {
private:
Font times;
Text song_name;
public:
MyClass();
~MyClass();
void DrawMethod(RenderWindow&);
};
In constructor I load font, I set song_name font, song_name character size, color - that works fine. But when I try to use setString I get an unhandled exception error.
MyClass::MyClass() {
times.loadFromFile("C:/Windows/Fonts/times.ttf");
song_name.setFont(times);
song_name.setCharacterSize(16);
song_name.setColor(Color::White);
song_name.setStyle(Text::Bold);
//***Above works!***
//But this doesn't:
song_name.setString("and here's some text");
}
Same happens when I try to draw my text:
void MyClass::DrawMethod(RenderWindow& win) {
win.draw(song_name);
}
What's happening?