I was supposed to test a little game that a friend wrote, but something was wrong: I did not see a window, but only a taskbar icon (which I could use to close the invisible window).
It turned out that his screen resolution was higher than mine, and that an SFML window will become invisible when it gets created larger than the current screen resolution. I'm not talking about fullscreen windows, but default style windows.
Here is a minimal code example to reproduce this behaviour with SFML 2 RC on Windows 7:
#include <SFML/Window.hpp>
int main(int argc, char **argv) {
//Get the desktop mode and enlarge it by a pixel in either direction
sf::VideoMode videoMode = sf::VideoMode::getDesktopMode();
videoMode.width += 1; //alternatively, increase the height by one
//Create the window - it'll be invisible
sf::Window window(videoMode, "Window size test");
//main loop, irrelevant to reproduce the bug
sf::Event e;
while(window.isOpen()) {
window.display();
while(window.pollEvent(e)) {
if(e.type == sf::Event::Closed)
window.close();
}
}
return 0;
}
I am not sure whether this is a bug. Of course, the developer should be aware that there might be people still using low resolutions. However, neither am I sure whether it is good that the window is entirely invisible.
Is this a Windows fault or is there something SFML can do to fix it?