Hi,
I'm having an issue and am wondering if it could possibly be a bug in SFML. I think it might be related to the issue described at this link <https://github.com/SFML/SFML/pull/1345>, though the symptoms I'm experiencing seem to be quite a bit different.
I'm using SFML 2.4.2. I don't know how to determine the build number, but I downloaded it on 2017-12-17 in case that helps.
My computer is a Windows 10 Home machine, 64-bit, with an i7, 8.00 GB, AMD Radeon HD 5450, and I'm use Microsoft Visual Studio Community 2017.
Here is the minimal code which consistently reproduces the issue:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
int __stdcall WinMain(long, long, char *, int)
{
sf::RenderWindow window;
sf::Font font ;
sf::Text text ;
sf::Event event ;
window.create(sf::VideoMode(500, 300), "My Window");
auto fnDrawText = [&](int x, int y, char const * sz)
{
text.setString(sz);
text.setPosition(x, y);
window.draw(text);
};
while (window.isOpen())
{
window.clear();
font.loadFromFile("SomeFont.TTF");
text.setFont(font);
text.setCharacterSize(10);
fnDrawText(100, 100, "My Text 1");
fnDrawText(100, 120, "My Text 2");
fnDrawText(100, 130, "My Text 1");
// fnDrawText(100, 160, "ABCDEFG"); // Uncomment this line and everything works
window.display();
while (window.pollEvent(event))
if (event.type == sf::Event::Closed) { window.close(); }
}
return 0;
}
With that code as-is, you will only get two lines of code output on the screen and it will be "My Text 2" followed by "My Text 1". (So the first instance of "My Text 1" is missing.)
If you uncomment the last invocation of fnDrawText, then the output changes and all four lines of text will be output, including the initial instance of "My Text 1" which had previously been missing.
Does anybody have any ideas of what could be causing this? (I'm a newbie to SFML.)
Thank you,
GeoCompute