#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <ioStream>
int main()
{
sf::Text testText;
sf::Font font;
font.loadFromFile("cour.ttf");
testText.setFont(font);
testText.setString("Hello World");
testText.setPosition(200, 200);
testText.setCharacterSize(25);
// Create the main window
sf::RenderWindow renderWindow(sf::VideoMode(WIDTH, HEIGHT), "SFML window");
// Start the game loop
while (renderWindow.isOpen())
{
// Process events
sf::Event event;
while (renderWindow.pollEvent(event))
{
// Close window : exit
if (event.type == sf::Event::Closed)
renderWindow.close();
}
// Clear screen
renderWindow.clear();
// Draw sprites
renderWindow.draw(testText);
// Update the window
renderWindow.display();
}
return EXIT_SUCCESS;
}
No matter what I do, I cannot get an sf::Text object to draw without the app instantly crashing. Been plagued by this problem for months. I've asked reddit, stack overflow and even here. I'm hoping for better results, because I have no idea what else to do to make it work. I have reinstalled both code::blocks and sfml. I installed sfml and Code::Blocks on a different pc, same problem. I have tried different fonts, same problem. All other SFML features function exactly as they should.
I'm using Code::Blocks v17.12 and SFML v2.5.1
If I comment out
font.setFont
, it will run (though not draw obviously). If I comment out
renderWindow.draw(testText)
it will run without a crash.
If I run debugger I get the info that the problem file is C:\Windows\SysWOW64\ig4icd32.dll. I've tried looking that up, but get nothing related to my problem.
Any help is appreciated. Also, if anyone knows a work around, I would appreciate it.