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

Author Topic: Possible Fullscreen Resolution change bug on Mac 10.13.3  (Read 2493 times)

0 Members and 1 Guest are viewing this topic.

AshleyF

  • Newbie
  • *
  • Posts: 30
    • View Profile
Possible Fullscreen Resolution change bug on Mac 10.13.3
« on: March 20, 2018, 01:21:02 am »
Dear All,

I have found what I think may well be a bug in SFML 2.4.2 on macOS 10.13.3.

I want to be able to switch between different fullscreen resolution rates by pressing a button during the application's execution.

The following source code was taken and adapted from a forum post by Raptor88.

int main()
{
    std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes();
   
    size_t mode = 0;
    sf::RenderWindow Window(modes[mode], "SFML Sample Application");
   
    while (Window.isOpen())
    {
        sf::Event Event;
        while(Window.pollEvent(Event))
        {
            switch (Event.type)
            {
                case sf::Event::Closed:
                    Window.close();
                    break;
                case sf::Event::KeyPressed:
                    if (Event.key.code == sf::Keyboard::Escape)
                    {
                        Window.close();
                    } else if (Event.key.code == sf::Keyboard::F2 && mode < modes.size() - 1)
                    {
                        Window.create(sf::VideoMode(modes[++mode]), "Mode", sf::Style::Fullscreen);
                    } else if (Event.key.code == sf::Keyboard::F1 && mode > 0)
                    {
                        Window.create(sf::VideoMode(modes[--mode]), "Mode", sf::Style::Fullscreen);
                    }
                    break;
                default:
                    break;
            }
        }
       
        Window.clear(sf::Color(0, 255, 255) );
        Window.display();
    }
   
    return 0;
}

This code appears to work fine on the PC, but not on the Mac.

The Mac shows the correct dimensions of the created window, but as a borderless window centred around the middle of the screen with a black border around it. The window doesn't stretch to cover the entire screen.

If anyone can please offer some advice concerning this, I'd be most grateful.

Kind regards,

AshleyF


Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
SFML / OS X developer

 

anything