Added constructors with parameters for shapes, and default-constructed shapes are now always empty
This commit is contained in:
parent
6034b80ddf
commit
44cc9bad84
@ -44,16 +44,14 @@ public :
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// Creates a circle with a radius of 10.
|
||||
/// \param radius Radius of the circle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CircleShape();
|
||||
CircleShape(float radius = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the radius of the circle
|
||||
///
|
||||
/// The default radius of a circle is 10.
|
||||
///
|
||||
/// \param radius New radius of the circle
|
||||
///
|
||||
/// \see GetRadius
|
||||
|
@ -45,16 +45,12 @@ public :
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// Creates a default triangle, just so that it's not empty.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ConvexShape();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the number of points of the polygon
|
||||
///
|
||||
/// The default number of points of a polygon is 6.
|
||||
///
|
||||
/// \param count New number of points of the polygon
|
||||
///
|
||||
/// \see GetPointsCount
|
||||
|
@ -44,16 +44,14 @@ public :
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// Creates a 10x10 rectangle.
|
||||
/// \param size Size of the rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RectangleShape();
|
||||
RectangleShape(const Vector2f& size = Vector2f(0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the size of the rectangle
|
||||
///
|
||||
/// The default size of a rectangle is 10x10.
|
||||
///
|
||||
/// \param size New size of the rectangle
|
||||
///
|
||||
/// \see GetSize
|
||||
|
@ -44,16 +44,21 @@ public :
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// Creates a star with 5 points, an inner radius of 10 and
|
||||
/// an outer radius of 20.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
StarShape();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the inner radius of the star
|
||||
/// \brief Constructor
|
||||
///
|
||||
/// The default inner radius of a star is 10.
|
||||
/// \param innerRadius Inner radius of the star
|
||||
/// \param outerRadius Outer radius of the star
|
||||
/// \param pointsCount Number of points of the star
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
StarShape(float innerRadius, float outerRadius, unsigned int pointsCount);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the inner radius of the star
|
||||
///
|
||||
/// \param radius New inner radius of the star
|
||||
///
|
||||
@ -75,8 +80,6 @@ public :
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the outer radius of the star
|
||||
///
|
||||
/// The default outer radius of a star is 20.
|
||||
///
|
||||
/// \param radius New outer radius of the star
|
||||
///
|
||||
/// \see GetOuterRadius
|
||||
@ -97,8 +100,6 @@ public :
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the number of points of the star
|
||||
///
|
||||
/// The default number of points of a star is 5.
|
||||
///
|
||||
/// \param count New number of points of the star
|
||||
///
|
||||
/// \see GetPointsCount
|
||||
|
@ -32,9 +32,9 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
CircleShape::CircleShape() :
|
||||
myRadius(10)
|
||||
CircleShape::CircleShape(float radius)
|
||||
{
|
||||
SetRadius(radius);
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,13 +31,10 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
ConvexShape::ConvexShape()
|
||||
ConvexShape::ConvexShape() :
|
||||
myPoints()
|
||||
{
|
||||
// Let's define a triangle by default... just so that it's not empty
|
||||
SetPointsCount(3);
|
||||
SetPoint(0, Vector2f(5, 0));
|
||||
SetPoint(1, Vector2f(0, 10));
|
||||
SetPoint(2, Vector2f(10, 10));
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,9 +32,9 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
RectangleShape::RectangleShape() :
|
||||
mySize(10, 10)
|
||||
RectangleShape::RectangleShape(const Vector2f& size) :
|
||||
{
|
||||
SetSize(size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -33,10 +33,21 @@ namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
StarShape::StarShape() :
|
||||
myInnerRadius(10),
|
||||
myOuterRadius(20),
|
||||
myPointsCount(5)
|
||||
myInnerRadius(0),
|
||||
myOuterRadius(0),
|
||||
myPointsCount(0)
|
||||
{
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
StarShape::StarShape(float innerRadius, float outerRadius, unsigned int pointsCount) :
|
||||
myInnerRadius(innerRadius),
|
||||
myOuterRadius(outerRadius),
|
||||
myPointsCount(pointsCount)
|
||||
{
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user