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

Author Topic: Fullscreen window contents are being offset from top, but only sometimes?  (Read 2306 times)

0 Members and 3 Guests are viewing this topic.

soaproap

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
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:
  • When I compile the 'Release' build of my project and attempt to run it outside of the IDE.
  • When I enable anti-aliasing or add any instructions in my game loop that slow down my game significantly.

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!

soaproap

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
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.

korczurekk

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • Email
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";