Now using Vector2 and Vector3 structs in functions

This commit is contained in:
Laurent Gomila committed 2012-03-09 01:08:08 +01:00
1 parent 69433eb0a4
commit 9d0d0588b2
28 files changed
+566 -608

No files matched your search

+25 -29
View File
@@ -32,10 +32,11 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
typedef unsigned int (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape
typedef void (*sfShapeGetPointCallback)(unsigned int, float*, float*, void*); ///< Type of the callback used to get a point of a shape
typedef unsigned int (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape
typedef sfVector2f (*sfShapeGetPointCallback)(unsigned int, void*); ///< Type of the callback used to get a point of a shape
////////////////////////////////////////////////////////////
/// \brief Create a new shape
@@ -64,21 +65,20 @@ CSFML_GRAPHICS_API void sfShape_Destroy(sfShape* shape);
///
/// This function completely overwrites the previous position.
/// See sfShape_Move to apply an offset based on the previous position instead.
/// The default position of a shape object is (0, 0).
/// The default position of a circle Shape object is (0, 0).
///
/// \param shape Shape object
/// \param x X coordinate of the new position
/// \param y Y coordinate of the new position
/// \param shape Shape object
/// \param position New position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_SetPosition(sfShape* shape, float x, float y);
CSFML_GRAPHICS_API void sfShape_SetPosition(sfShape* shape, sfVector2f position);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of a shape
///
/// This function completely overwrites the previous rotation.
/// See sfShape_Rotate to add an angle based on the previous rotation instead.
/// The default rotation of a shape object is 0.
/// The default rotation of a circle Shape object is 0.
///
/// \param shape Shape object
/// \param angle New rotation, in degrees
@@ -91,14 +91,13 @@ CSFML_GRAPHICS_API void sfShape_SetRotation(sfShape* shape, float angle);
///
/// This function completely overwrites the previous scale.
/// See sfShape_Scale to add a factor based on the previous scale instead.
/// The default scale of a shape object is (1, 1).
/// The default scale of a circle Shape object is (1, 1).
///
/// \param shape Shape object
/// \param factorX New horizontal scale factor
/// \param factorY New vertical scale factor
/// \param shape Shape object
/// \param scale New scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_SetScale(sfShape* shape, float factorX, float factorY);
CSFML_GRAPHICS_API void sfShape_SetScale(sfShape* shape, sfVector2f scale);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of a shape
@@ -108,14 +107,13 @@ CSFML_GRAPHICS_API void sfShape_SetScale(sfShape* shape, float factorX, float fa
/// The coordinates of this point must be relative to the
/// top-left corner of the object, and ignore all
/// transformations (position, scale, rotation).
/// The default origin of a shape object is (0, 0).
/// The default origin of a circle Shape object is (0, 0).
///
/// \param shape Shape object
/// \param x X coordinate of the new origin
/// \param y Y coordinate of the new origin
/// \param shape Shape object
/// \param origin New origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_SetOrigin(sfShape* shape, float x, float y);
CSFML_GRAPHICS_API void sfShape_SetOrigin(sfShape* shape, sfVector2f origin);
////////////////////////////////////////////////////////////
/// \brief Get the position of a shape
@@ -125,7 +123,7 @@ CSFML_GRAPHICS_API void sfShape_SetOrigin(sfShape* shape, float x, float y);
/// \return Current position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_GetPosition(const sfShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfShape_GetPosition(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the orientation of a shape
@@ -147,7 +145,7 @@ CSFML_GRAPHICS_API float sfShape_GetRotation(const sfShape* shape);
/// \return Current scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_GetScale(const sfShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfShape_GetScale(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the local origin of a shape
@@ -157,7 +155,7 @@ CSFML_GRAPHICS_API void sfShape_GetScale(const sfShape* shape, float* x, float*
/// \return Current origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_GetOrigin(const sfShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfShape_GetOrigin(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Move a shape by a given offset
@@ -165,12 +163,11 @@ CSFML_GRAPHICS_API void sfShape_GetOrigin(const sfShape* shape, float* x, float*
/// This function adds to the current position of the object,
/// unlike sfShape_SetPosition which overwrites it.
///
/// \param shape Shape object
/// \param offsetX X offset
/// \param offsetY Y offset
/// \param shape Shape object
/// \param offset Offset
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_Move(sfShape* shape, float offsetX, float offsetY);
CSFML_GRAPHICS_API void sfShape_Move(sfShape* shape, sfVector2f offset);
////////////////////////////////////////////////////////////
/// \brief Rotate a shape
@@ -191,11 +188,10 @@ CSFML_GRAPHICS_API void sfShape_Rotate(sfShape* shape, float angle);
/// unlike sfShape_SetScale which overwrites it.
///
/// \param shape Shape object
/// \param factorX Horizontal scale factor
/// \param factorY Vertical scale factor
/// \param factors Scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_Scale(sfShape* shape, float factorX, float factorY);
CSFML_GRAPHICS_API void sfShape_Scale(sfShape* shape, sfVector2f factors);
////////////////////////////////////////////////////////////
/// \brief Get the combined transform of a shape
@@ -367,7 +363,7 @@ CSFML_GRAPHICS_API unsigned int sfShape_GetPointCount(const sfShape* shape);
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_GetPoint(const sfShape* shape, unsigned int index, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfShape_GetPoint(const sfShape* shape, unsigned int index);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a shape