#includeint main() { sf::FloatRect rect1(10, 10, 50, 50); sf::FloatRect rect2(30, 30, 50, 50); // finding intersection sf::FloatRect intersection = rect1.intersect(rect2); // displaying results std::cout << "Intersection Left = " << intersection.left << std::endl; std::cout << "Intersection Top = " << intersection.top << std::endl; std::cout << "Intersection Width = " << intersection.width << std::endl; std::cout << "Intersection Height = " << intersection.height << std::endl; return 0; }
#includeint main() { sf::FloatRect rect1(10, 10, 50, 50); sf::FloatRect rect2(60, 60, 50, 50); // checking if rectangles intersect if (rect1.intersects(rect2)) { std::cout << "Rectangles intersect" << std::endl; } else { std::cout << "Rectangles do not intersect" << std::endl; } return 0; }