Implement getGeometricCenter

This commit is contained in:
Chris Thrasher committed 2024-09-20 16:29:34 -05:00
1 parent 77b3035308
commit fbe6e6193f
8 files changed
+88

No files matched your search

+14
View File
@@ -369,6 +369,20 @@ CSFML_GRAPHICS_API size_t sfCircleShape_getPointCount(const sfCircleShape* shape
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get the geometric center of the circle
///
/// The returned point is in local coordinates, that is,
/// the shape's transforms (position, rotation, scale) are
/// not taken into account.
///
/// \param shape Shape object
///
/// \return The geometric center of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getGeometricCenter(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Set the radius of a circle
///
+14
View File
@@ -369,6 +369,20 @@ CSFML_GRAPHICS_API size_t sfConvexShape_getPointCount(const sfConvexShape* shape
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get the geometric center of a convex shape
///
/// The returned point is in local coordinates, that is,
/// the shape's transforms (position, rotation, scale) are
/// not taken into account.
///
/// \param shape Shape object
///
/// \return The geometric center of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getGeometricCenter(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Set the number of points of a convex shap
///
+14
View File
@@ -369,6 +369,20 @@ CSFML_GRAPHICS_API size_t sfRectangleShape_getPointCount(const sfRectangleShape*
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get the geometric center of the rectangle
///
/// The returned point is in local coordinates, that is,
/// the shape's transforms (position, rotation, scale) are
/// not taken into account.
///
/// \param shape Shape object
///
/// \return The geometric center of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getGeometricCenter(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Set the size of a rectangle shape
///
+14
View File
@@ -368,6 +368,20 @@ CSFML_GRAPHICS_API size_t sfShape_getPointCount(const sfShape* shape);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get the geometric center of the shape
///
/// The returned point is in local coordinates, that is,
/// the shape's transforms (position, rotation, scale) are
/// not taken into account.
///
/// \param shape Shape object
///
/// \return The geometric center of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfShape_getGeometricCenter(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a shape
///
+8
View File
@@ -263,6 +263,14 @@ sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, size_t index)
}
////////////////////////////////////////////////////////////
sfVector2f sfCircleShape_getGeometricCenter(const sfCircleShape* shape)
{
assert(shape);
return convertVector2(shape->This.getGeometricCenter());
}
////////////////////////////////////////////////////////////
void sfCircleShape_setRadius(sfCircleShape* shape, float radius)
{
+8
View File
@@ -260,6 +260,14 @@ sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, size_t index)
}
////////////////////////////////////////////////////////////
sfVector2f sfConvexShape_getGeometricCenter(const sfConvexShape* shape)
{
assert(shape);
return convertVector2(shape->This.getGeometricCenter());
}
////////////////////////////////////////////////////////////
void sfConvexShape_setPointCount(sfConvexShape* shape, size_t count)
{
+8
View File
@@ -260,6 +260,14 @@ sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, size_t index
}
////////////////////////////////////////////////////////////
sfVector2f sfRectangleShape_getGeometricCenter(const sfRectangleShape* shape)
{
assert(shape);
return convertVector2(shape->This.getGeometricCenter());
}
////////////////////////////////////////////////////////////
void sfRectangleShape_setSize(sfRectangleShape* shape, sfVector2f size)
{
+8
View File
@@ -252,6 +252,14 @@ sfVector2f sfShape_getPoint(const sfShape* shape, size_t index)
}
////////////////////////////////////////////////////////////
sfVector2f sfShape_getGeometricCenter(const sfShape* shape)
{
assert(shape);
return convertVector2(shape->getGeometricCenter());
}
////////////////////////////////////////////////////////////
sfFloatRect sfShape_getLocalBounds(const sfShape* shape)
{