IntRect rect(10, 20, 30, 40); // initial rectangle rect.inflate(5, 10); // increases width by 10 and height by 20
#includeThis code uses the SFML library to create a window and display a red rectangle that moves to the right and gradually increases in size. The IntRect::inflate function is called on the rectangle's global bounds to increase the rectangle's size. The SFML library provides methods for working with IntRect objects. In conclusion, the IntRect::inflate function is part of the SFML library, which provides a convenient way to increase or decrease the size of a rectangle with integer coordinates.int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "My window"); sf::RectangleShape rect(sf::Vector2f(50, 50)); rect.setFillColor(sf::Color::Red); rect.setPosition(100, 100); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) { window.close(); } } rect.move(1, 0); // move the rectangle rect.getGlobalBounds().inflate(5, 5); // increase its size window.clear(sf::Color::White); window.draw(rect); window.display(); } return 0; }