Answers for "how to keep aspect ratio sfml"

C++
1

how to keep aspect ratio sfml

// the event loop
sf::Event event;
while (window.pollEvent(event))
{
    ...

    // catch the resize events
    if (event.type == sf::Event::Resized)
    {
        // update the view to the new size of the window
        sf::FloatRect visibleArea(0, 0, event.size.width, event.size.height);
        window.setView(sf::View(visibleArea));
    }
}
Posted by: Guest on August-07-2021

Code answers related to "how to keep aspect ratio sfml"

Browse Popular Code Answers by Language