Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Windows] Windows larger than the desktop mode are invisible  (Read 2815 times)

0 Members and 1 Guest are viewing this topic.

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
[Windows] Windows larger than the desktop mode are invisible
« on: September 19, 2012, 08:26:10 pm »
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?
JSFML - The Java binding to SFML.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: [Windows] Windows larger than the desktop mode are invisible
« Reply #1 on: September 19, 2012, 08:42:54 pm »
Issue #234

And various posts on the forum... ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/