From 5bd37225983e6b1948a1dab08d65800ba9f4e8c3 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sat, 18 Feb 2023 23:01:18 -0700 Subject: [PATCH] Fix `sf::Rect` docs --- include/SFML/Graphics/Rect.hpp | 4 ++-- include/SFML/Graphics/Sprite.hpp | 2 +- include/SFML/Graphics/Transform.hpp | 2 +- include/SFML/Graphics/View.hpp | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/SFML/Graphics/Rect.hpp b/include/SFML/Graphics/Rect.hpp index 4dfde063..cad47bd7 100644 --- a/include/SFML/Graphics/Rect.hpp +++ b/include/SFML/Graphics/Rect.hpp @@ -46,7 +46,7 @@ public: /// \brief Default constructor /// /// Creates an empty rectangle (it is equivalent to calling - /// Rect(0, 0, 0, 0)). + /// Rect({0, 0}, {0, 0})). /// //////////////////////////////////////////////////////////// constexpr Rect(); @@ -191,7 +191,7 @@ using FloatRect = Rect; /// \li The left and top edges are included in the rectangle's area /// \li The right (left + width) and bottom (top + height) edges are excluded from the rectangle's area /// -/// This means that sf::IntRect(0, 0, 1, 1) and sf::IntRect(1, 1, 1, 1) +/// This means that sf::IntRect({0, 0}, {1, 1}) and sf::IntRect({1, 1}, {1, 1}) /// don't intersect. /// /// sf::Rect is a template and may be used with any numeric type, but diff --git a/include/SFML/Graphics/Sprite.hpp b/include/SFML/Graphics/Sprite.hpp index a33b9782..85d45f8d 100644 --- a/include/SFML/Graphics/Sprite.hpp +++ b/include/SFML/Graphics/Sprite.hpp @@ -279,7 +279,7 @@ private: /// // Create a sprite /// sf::Sprite sprite; /// sprite.setTexture(texture); -/// sprite.setTextureRect(sf::IntRect(10, 10, 50, 30)); +/// sprite.setTextureRect(sf::IntRect({10, 10}, {50, 30})); /// sprite.setColor(sf::Color(255, 255, 255, 200)); /// sprite.setPosition(100, 25); /// diff --git a/include/SFML/Graphics/Transform.hpp b/include/SFML/Graphics/Transform.hpp index 26513b5f..b510b87f 100644 --- a/include/SFML/Graphics/Transform.hpp +++ b/include/SFML/Graphics/Transform.hpp @@ -382,7 +382,7 @@ constexpr Vector2f operator*(const Transform& left, const Vector2f& right); /// /// // use the result to transform stuff... /// sf::Vector2f point = transform.transformPoint(10, 20); -/// sf::FloatRect rect = transform.transformRect(sf::FloatRect(0, 0, 10, 100)); +/// sf::FloatRect rect = transform.transformRect(sf::FloatRect({0, 0}, {10, 100})); /// \endcode /// /// \see sf::Transformable, sf::RenderStates diff --git a/include/SFML/Graphics/View.hpp b/include/SFML/Graphics/View.hpp index 1622d9c1..1e7b2fb5 100644 --- a/include/SFML/Graphics/View.hpp +++ b/include/SFML/Graphics/View.hpp @@ -108,7 +108,7 @@ public: /// view are displayed, expressed as a factor (between 0 and 1) /// of the size of the RenderTarget to which the view is applied. /// For example, a view which takes the left side of the target would - /// be defined with View.setViewport(sf::FloatRect(0, 0, 0.5, 1)). + /// be defined with View.setViewport(sf::FloatRect({0.f, 0.f}, {0.5f, 1.f})). /// By default, a view has a viewport which covers the entire target. /// /// \param viewport New viewport rectangle @@ -278,13 +278,13 @@ private: /// sf::View view; /// /// // Initialize the view to a rectangle located at (100, 100) and with a size of 400x200 -/// view.reset(sf::FloatRect(100, 100, 400, 200)); +/// view.reset(sf::FloatRect({100, 100}, {400, 200})); /// /// // Rotate it by 45 degrees /// view.rotate(sf::degrees(45)); /// /// // Set its target viewport to be half of the window -/// view.setViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f)); +/// view.setViewport(sf::FloatRect({0.f, 0.f}, {0.5f, 1.f})); /// /// // Apply it /// window.setView(view);