#include#include int main() { sf::FloatRect rect(10.f, 20.f, 30.f, 40.f); std::cout << "Old height: " << rect.height << std::endl; rect.setHeight(50.f); std::cout << "New height: " << rect.height << std::endl; return 0; }
#includeThis code does the same thing as the first example, but instead of using the setHeight method, it directly modifies the height attribute of the FloatRect object. Overall, FloatRect and its methods like setHeight are useful for working with rectangles in SFML.#include int main() { sf::FloatRect rect(10.f, 20.f, 30.f, 40.f); std::cout << "Old height: " << rect.height << std::endl; rect.height = 50.f; std::cout << "New height: " << rect.height << std::endl; return 0; }