SFML community forums

Help => Window => Topic started by: soaproap on October 11, 2016, 10:28:18 pm

Title: Fullscreen window contents are being offset from top, but only sometimes?
Post by: soaproap on October 11, 2016, 10:28:18 pm
Hello!

I am working on developing a game using SFML. It runs in fullscreen, and the RenderWindow is initialized as follows:

RenderWindow *app = nullptr;
int
main ()
{
    app = new RenderWindow(VideoMode::getDesktopMode(), "mystery", Style::Fullscreen);
    // ... rest of game here
}
 

Although it runs fine when testing from within Code::Blocks IDE, I experience an issue under the following circumstances:

The problem is, under these conditions, everything in the window is offset from the top by several hundred pixels (although click detection occurs as if it were not.) I would appreciate if somebody could tell me what is wrong (or ask of more information from me about my code, if I haven't provided enough!) Thanks!
Title: Re: Fullscreen window contents are being offset from top, but only sometimes?
Post by: soaproap on October 11, 2016, 10:33:37 pm
Update: I am now using:
VideoMode::getFullscreenModes().at(0)
This seems to work, although I haven't tested it enough to be sure my issue is entirely gone.
Title: Re: Fullscreen window contents are being offset from top, but only sometimes?
Post by: korczurekk on October 11, 2016, 11:23:52 pm
Is your OS Linux? I experienced a few resolution-related errors (wrong res in fullscreen mode) and your problem may be something simillar.

What is output of this code when error occurs?
auto mode = VideoMode::getDesktopMode();
std::cout << "[" << mode.width << ", " << mode.height << "]\n";