diff --git a/include/SFML/Graphics/Rect.hpp b/include/SFML/Graphics/Rect.hpp index f3c6d3b6d..466db4d07 100644 --- a/include/SFML/Graphics/Rect.hpp +++ b/include/SFML/Graphics/Rect.hpp @@ -151,6 +151,26 @@ public: //////////////////////////////////////////////////////////// bool intersects(const Rect& rectangle, Rect& intersection) const; + //////////////////////////////////////////////////////////// + /// \brief Get the position of the rectangle's top-left corner + /// + /// \return Position of rectangle + /// + /// \see getSize + /// + //////////////////////////////////////////////////////////// + sf::Vector2 getPosition() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the size of the rectangle + /// + /// \return Size of rectangle + /// + /// \see getPosition + /// + //////////////////////////////////////////////////////////// + sf::Vector2 getSize() const; + //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// diff --git a/include/SFML/Graphics/Rect.inl b/include/SFML/Graphics/Rect.inl index ef3fc3459..1aa073dca 100644 --- a/include/SFML/Graphics/Rect.inl +++ b/include/SFML/Graphics/Rect.inl @@ -141,6 +141,18 @@ bool Rect::intersects(const Rect& rectangle, Rect& intersection) const } } +template +sf::Vector2 Rect::getPosition() const +{ + return sf::Vector2(left, top); +} + +template +sf::Vector2 Rect::getSize() const +{ + return sf::Vector2(width, height); +} + //////////////////////////////////////////////////////////// template