Saturday, July 16, 2022
HomeGame Developmentsfml - Is it ineffective to test whether or not a window...

sfml – Is it ineffective to test whether or not a window is requested to be closed in full-screen mode?


Is it nonetheless essential to test if the window is requested to be closed after I put together a 1920×1080 window, in full-screen mode? How might the consumer shut the window in full-screen mode, when you could possibly not click on the X button of the window? I take this code from a guide.

int primary()
{
    // Create a video mode object
    VideoMode vm(1920, 1080);
    // Create and open a window for the sport
    RenderWindow window(vm, "Pong", Type::Fullscreen);
    /*
    Some code right here
    *******************************
    *******************************
    *******************************
    */
    whereas (window.isOpen())
    {
        /*
        Deal with the participant enter
        *******************************
        *******************************
        *******************************
        */
        Occasion occasion;
        whereas (window.pollEvent(occasion))
        {
           if (occasion.kind == Occasion::Closed)
           {
               // Give up the sport when the window is closed
               window.shut();
           }
        }
        /*
        Replace the bat, the ball and the HUD
        ****************************
        ****************************
        ****************************
        */
        /*
        Draw the bat, the ball and the HUD
        ****************************
        ****************************
        ****************************
        */
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments