Hi. I'm trying to put some buttons on screen. I'm getting an unhandled exception:
"Unhandled exception at 0x72EE2B2B (sfml-system-d-2.dll) in blue.exe: 0xC0000005: Access violation reading location 0x00000238."
Bellow is my code. The offending line is "new_game_button->setText("New Game");" But if I delete this line, the next line that uses the new_game_button pointer gives me the same exception. If I just create the button and don't modify it, just call gui.add(new_game_button), it crashes during runtime.
int main()
{
sf::RenderWindow window(sf::VideoMode(1280, 720), "SFML works!");
tgui::Gui gui(window);
gui.setFont("DejaVuSans.ttf");
tgui::Button::Ptr new_game_button;
new_game_button->setText("New Game");
new_game_button->setPosition(1000, 200);
new_game_button->setSize(50, 50);
gui.add(new_game_button);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
gui.draw();
window.display();
}
return 0;
}