diff --git a/CSFML/include/SFML/Graphics/Shape.h b/CSFML/include/SFML/Graphics/Shape.h
index 48687084..47318816 100644
--- a/CSFML/include/SFML/Graphics/Shape.h
+++ b/CSFML/include/SFML/Graphics/Shape.h
@@ -58,14 +58,14 @@ CSFML_API sfShape* sfShape_CreateLine(float p1x, float p1y, float p2x, float p2y
////////////////////////////////////////////////////////////
/// Create a new shape made of a single rectangle
///
-/// \param p1x, p1y : Position of the first point
-/// \param p2x, p2y : Position second point
-/// \param color : Color used to fill the rectangle
-/// \param outline : Outline width
-/// \param outlineColor : Color used to draw the outline
+/// \param left, top : Top-left corner of the rectangle
+/// \param width, height : Size of the rectangle
+/// \param color : Color used to fill the rectangle
+/// \param outline : Outline width
+/// \param outlineColor : Color used to draw the outline
///
////////////////////////////////////////////////////////////
-CSFML_API sfShape* sfShape_CreateRectangle(float p1x, float p1y, float p2x, float p2y, sfColor color, float outline, sfColor outlineColor);
+CSFML_API sfShape* sfShape_CreateRectangle(float left, float top, float width, float height, sfColor color, float outline, sfColor outlineColor);
////////////////////////////////////////////////////////////
/// Create a new shape made of a single circle
diff --git a/CSFML/src/SFML/Graphics/Shape.cpp b/CSFML/src/SFML/Graphics/Shape.cpp
index 16d9812a..fc94ce53 100644
--- a/CSFML/src/SFML/Graphics/Shape.cpp
+++ b/CSFML/src/SFML/Graphics/Shape.cpp
@@ -57,13 +57,13 @@ sfShape* sfShape_CreateLine(float p1x, float p1y, float p2x, float p2y, float th
////////////////////////////////////////////////////////////
/// Create a new shape made of a single rectangle
////////////////////////////////////////////////////////////
-sfShape* sfShape_CreateRectangle(float p1x, float p1y, float p2x, float p2y, sfColor color, float outline, sfColor outlineColor)
+sfShape* sfShape_CreateRectangle(float left, float top, float width, float height, sfColor color, float outline, sfColor outlineColor)
{
sf::Color SFMLColor(color.r, color.g, color.b, color.a);
sf::Color SFMLOutlineColor(outlineColor.r, outlineColor.g, outlineColor.b, outlineColor.a);
sfShape* shape = new sfShape;
- shape->This = sf::Shape::Rectangle(p1x, p1y, p2x, p2y, SFMLColor, outline, SFMLOutlineColor);
+ shape->This = sf::Shape::Rectangle(left, top, width, height, SFMLColor, outline, SFMLOutlineColor);
return shape;
}
diff --git a/dotnet/src/Graphics/Shape.cs b/dotnet/src/Graphics/Shape.cs
index d0f84f72..346c0057 100644
--- a/dotnet/src/Graphics/Shape.cs
+++ b/dotnet/src/Graphics/Shape.cs
@@ -316,30 +316,28 @@ namespace SFML
///
/// Create a shape made of a single rectangle
///
- /// Position of the top-left corner
- /// Position of the bottom-right corner
+ /// Rectangle to create
/// Color used to fill the rectangle
/// New rectangle shape built with the given parameters
////////////////////////////////////////////////////////////
- public static Shape Rectangle(Vector2 p1, Vector2 p2, Color color)
+ public static Shape Rectangle(FloatRect rectangle, Color color)
{
- return Rectangle(p1, p2, color, 0, Color.White);
+ return Rectangle(rectangle, color, 0, Color.White);
}
////////////////////////////////////////////////////////////
///
/// Create a shape made of a single rectangle
///
- /// Position of the top-left corner
- /// Position of the bottom-right corner
+ /// Rectangle to create
/// Color used to fill the rectangle
/// Outline width
/// Color used to draw the outline
/// New rectangle shape built with the given parameters
////////////////////////////////////////////////////////////
- public static Shape Rectangle(Vector2 p1, Vector2 p2, Color color, float outline, Color outlineColor)
+ public static Shape Rectangle(FloatRect rectangle, Color color, float outline, Color outlineColor)
{
- return new Shape(sfShape_CreateRectangle(p1.X, p1.Y, p2.X, p2.Y, color, outline, outlineColor));
+ return new Shape(sfShape_CreateRectangle(rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height, color, outline, outlineColor));
}
////////////////////////////////////////////////////////////
diff --git a/include/SFML/Graphics/Shape.hpp b/include/SFML/Graphics/Shape.hpp
index 32a3933c..1574441e 100644
--- a/include/SFML/Graphics/Shape.hpp
+++ b/include/SFML/Graphics/Shape.hpp
@@ -206,28 +206,27 @@ public :
static Shape Line(const Vector2f& p1, const Vector2f& p2, float thickness, const Color& color, float outline = 0.f, const Color& outlineColor = Color(0, 0, 0));
////////////////////////////////////////////////////////////
- /// Create a shape made of a single rectangle (use floats)
+ /// Create a shape made of a single rectangle
///
- /// \param p1x, p1y : Position of the first point
- /// \param p2x, p2y : Position second point
- /// \param color : Color used to fill the rectangle
- /// \param outline : Outline width
- /// \param outlineColor : Color used to draw the outline
+ /// \param left, top : Position of the top-left corner
+ /// \param width, height : Size of the rectangle
+ /// \param color : Color used to fill the rectangle
+ /// \param outline : Outline width
+ /// \param outlineColor : Color used to draw the outline
///
////////////////////////////////////////////////////////////
- static Shape Rectangle(float p1x, float p1y, float p2x, float p2y, const Color& color, float outline = 0.f, const Color& outlineColor = Color(0, 0, 0));
+ static Shape Rectangle(float left, float top, float width, float height, const Color& color, float outline = 0.f, const Color& outlineColor = Color(0, 0, 0));
////////////////////////////////////////////////////////////
- /// Create a shape made of a single rectangle (use vectors)
+ /// Create a shape made of a single rectangle
///
- /// \param p1 : Position of the first point
- /// \param p2 : Position second point
+ /// \param rectangle : Rectangle
/// \param color : Color used to fill the rectangle
/// \param outline : Outline width
/// \param outlineColor : Color used to draw the outline
///
////////////////////////////////////////////////////////////
- static Shape Rectangle(const Vector2f& p1, const Vector2f& p2, const Color& color, float outline = 0.f, const Color& outlineColor = Color(0, 0, 0));
+ static Shape Rectangle(const FloatRect& rectangle, const Color& color, float outline = 0.f, const Color& outlineColor = Color(0, 0, 0));
////////////////////////////////////////////////////////////
/// Create a shape made of a single circle (use floats)
diff --git a/src/SFML/Graphics/Shape.cpp b/src/SFML/Graphics/Shape.cpp
index 3f3f4a1d..5721fe5e 100644
--- a/src/SFML/Graphics/Shape.cpp
+++ b/src/SFML/Graphics/Shape.cpp
@@ -218,14 +218,14 @@ Shape Shape::Line(const Vector2f& p1, const Vector2f& p2, float thickness, const
////////////////////////////////////////////////////////////
/// Create a shape made of a single rectangle
////////////////////////////////////////////////////////////
-Shape Shape::Rectangle(float p1x, float p1y, float p2x, float p2y, const Color& color, float outline, const Color& outlineColor)
+Shape Shape::Rectangle(float left, float top, float width, float height, const Color& color, float outline, const Color& outlineColor)
{
// Create the shape's points
Shape shape;
- shape.AddPoint(Vector2f(p1x, p1y), color, outlineColor);
- shape.AddPoint(Vector2f(p2x, p1y), color, outlineColor);
- shape.AddPoint(Vector2f(p2x, p2y), color, outlineColor);
- shape.AddPoint(Vector2f(p1x, p2y), color, outlineColor);
+ shape.AddPoint(Vector2f(left, top), color, outlineColor);
+ shape.AddPoint(Vector2f(left + width, top), color, outlineColor);
+ shape.AddPoint(Vector2f(left + width, top + height), color, outlineColor);
+ shape.AddPoint(Vector2f(left, top + height), color, outlineColor);
shape.SetOutlineWidth(outline);
// Compile it
@@ -236,11 +236,11 @@ Shape Shape::Rectangle(float p1x, float p1y, float p2x, float p2y, const Color&
////////////////////////////////////////////////////////////
-/// Create a shape made of a single rectangle (use vectors)
+/// Create a shape made of a single rectangle
////////////////////////////////////////////////////////////
-Shape Shape::Rectangle(const Vector2f& p1, const Vector2f& p2, const Color& color, float outline, const Color& outlineColor)
+Shape Shape::Rectangle(const FloatRect& rectangle, const Color& color, float outline, const Color& outlineColor)
{
- return Shape::Rectangle(p1.x, p1.y, p2.x, p2.y, color, outline, outlineColor);
+ return Shape::Rectangle(rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height, color, outline, outlineColor);
}