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

Author Topic: Duplicate windows on macOS (15.2) using SFML 2.6.2  (Read 365 times)

0 Members and 1 Guest are viewing this topic.

Oliver Ewald

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Duplicate windows on macOS (15.2) using SFML 2.6.2
« on: December 18, 2024, 07:58:06 pm »
I am using SFML (2.6.2) for macOS (15.2) on Xcode.
I face the problem that in ca. 8 out of 10 cases I get a duplicate (highly overlapping) window displayed.
I reduced my code to the below minimal code example that produces the problem:

#include <SFML/Graphics.hpp>
int main() {
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Test");
    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed)
                window.close();
        }
        window.clear(sf::Color::Black);
        window.display();
    }
    return 0;
}

Can anyone help me to solve that problem?
 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11049
    • View Profile
    • development blog
    • Email
Re: Duplicate windows on macOS (15.2) using SFML 2.6.2
« Reply #1 on: December 18, 2024, 10:58:06 pm »
Do you have a screenshot? I don't quite understand what "duplicate (highly overlapping)" means exactly.

When does this happen? At the start of the application? Do you start it multiple times?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Oliver Ewald

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Duplicate windows on macOS (15.2) using SFML 2.6.2
« Reply #2 on: December 19, 2024, 10:15:32 pm »
I got it working with a "sleep(0.2)" statement directly before the RenderWindow statement:

[...]
sleep(0.2);
RenderWindow window(VideoMode(504, 504), "The game of chess");
[...]