sfTransform is no longer a wrapper around a sf::Transform*, it is a simple structure

This commit is contained in:
Laurent Gomila committed 2012-05-22 17:56:01 +02:00
1 parent bf614690ad
commit bfebe0aab4
30 files changed
+179 -159

No files matched your search

+3 -2
View File
@@ -31,6 +31,7 @@
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
@@ -202,7 +203,7 @@ CSFML_GRAPHICS_API void sfCircleShape_scale(sfCircleShape* shape, sfVector2f fac
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getTransform(const sfCircleShape* shape);
CSFML_GRAPHICS_API sfTransform sfCircleShape_getTransform(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a circle shape
@@ -212,7 +213,7 @@ CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getTransform(const sfCircleS
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getInverseTransform(const sfCircleShape* shape);
CSFML_GRAPHICS_API sfTransform sfCircleShape_getInverseTransform(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a circle shape
+3 -2
View File
@@ -31,6 +31,7 @@
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
@@ -202,7 +203,7 @@ CSFML_GRAPHICS_API void sfConvexShape_scale(sfConvexShape* shape, sfVector2f fac
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getTransform(const sfConvexShape* shape);
CSFML_GRAPHICS_API sfTransform sfConvexShape_getTransform(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a convex shape
@@ -212,7 +213,7 @@ CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getTransform(const sfConvexS
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getInverseTransform(const sfConvexShape* shape);
CSFML_GRAPHICS_API sfTransform sfConvexShape_getInverseTransform(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a convex shape
+3 -2
View File
@@ -31,6 +31,7 @@
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
@@ -202,7 +203,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_scale(sfRectangleShape* shape, sfVector
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_getTransform(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfTransform sfRectangleShape_getTransform(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a rectangle shape
@@ -212,7 +213,7 @@ CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_getTransform(const sfRect
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_getInverseTransform(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfTransform sfRectangleShape_getInverseTransform(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a rectangle shape
+2 -1
View File
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/BlendMode.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
@@ -40,7 +41,7 @@
typedef struct
{
sfBlendMode blendMode; ///< Blending mode
sfTransform* transform; ///< Transform
sfTransform transform; ///< Transform
const sfTexture* texture; ///< Texture
const sfShader* shader; ///< Shader
} sfRenderStates;
+2 -1
View File
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/InputStream.h>
#include <SFML/System/Vector2.h>
@@ -290,7 +291,7 @@ CSFML_GRAPHICS_API void sfShader_setColorParameter(sfShader* shader, const char*
/// \param transform Transform to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setTransformParameter(sfShader* shader, const char* name, const sfTransform* transform);
CSFML_GRAPHICS_API void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform);
////////////////////////////////////////////////////////////
/// \brief Change a texture parameter of a shader
+3 -2
View File
@@ -31,6 +31,7 @@
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
@@ -201,7 +202,7 @@ CSFML_GRAPHICS_API void sfShape_scale(sfShape* shape, sfVector2f factors);
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfShape_getTransform(const sfShape* shape);
CSFML_GRAPHICS_API sfTransform sfShape_getTransform(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a shape
@@ -211,7 +212,7 @@ CSFML_GRAPHICS_API const sfTransform* sfShape_getTransform(const sfShape* shape)
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfShape_getInverseTransform(const sfShape* shape);
CSFML_GRAPHICS_API sfTransform sfShape_getInverseTransform(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a shape
+3 -2
View File
@@ -32,6 +32,7 @@
#include <SFML/Graphics/BlendMode.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
@@ -203,7 +204,7 @@ CSFML_GRAPHICS_API void sfSprite_scale(sfSprite* sprite, sfVector2f factors);
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfSprite_getTransform(const sfSprite* sprite);
CSFML_GRAPHICS_API sfTransform sfSprite_getTransform(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a sprite
@@ -213,7 +214,7 @@ CSFML_GRAPHICS_API const sfTransform* sfSprite_getTransform(const sfSprite* spri
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfSprite_getInverseTransform(const sfSprite* sprite);
CSFML_GRAPHICS_API sfTransform sfSprite_getInverseTransform(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a sprite
+3 -2
View File
@@ -32,6 +32,7 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
@@ -215,7 +216,7 @@ CSFML_GRAPHICS_API void sfText_scale(sfText* text, sfVector2f factors);
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfText_getTransform(const sfText* text);
CSFML_GRAPHICS_API sfTransform sfText_getTransform(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a text
@@ -225,7 +226,7 @@ CSFML_GRAPHICS_API const sfTransform* sfText_getTransform(const sfText* text);
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfText_getInverseTransform(const sfText* text);
CSFML_GRAPHICS_API sfTransform sfText_getInverseTransform(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Set the string of a text (from an ANSI string)
+27 -37
View File
@@ -34,15 +34,22 @@
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
/// \brief Create a new transform
///
/// This function creates an identity transform.
///
/// \return A new sfTransform object
/// \brief Encapsulate a 3x3 transform matrix
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTransform* sfTransform_create(void);
typedef struct
{
float matrix[9];
} sfTransform;
////////////////////////////////////////////////////////////
/// \brief Identity transform (does nothing)
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTransform sfTransform_Identity;
////////////////////////////////////////////////////////////
/// \brief Create a new transform from a matrix
@@ -60,46 +67,29 @@ CSFML_GRAPHICS_API sfTransform* sfTransform_create(void);
/// \return A new sfTransform object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTransform* sfTransform_createFromMatrix(float a00, float a01, float a02,
float a10, float a11, float a12,
float a20, float a21, float a22);
////////////////////////////////////////////////////////////
/// \brief Copy an existing transform
///
/// \param transform Transform to copy
///
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTransform* sfTransform_copy(sfTransform* transform);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing transform
///
/// \param transform Transform to delete
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransform_destroy(sfTransform* transform);
CSFML_GRAPHICS_API sfTransform sfTransform_fromMatrix(float a00, float a01, float a02,
float a10, float a11, float a12,
float a20, float a21, float a22);
////////////////////////////////////////////////////////////
/// \brief Return the 4x4 matrix of a transform
///
/// This function returns a pointer to an array of 16 floats
/// containing the transform elements as a 4x4 matrix, which
/// is directly compatible with OpenGL functions.
/// This function fills an array of 16 floats with the transform
/// converted as a 4x4 matrix, which is directly compatible with
/// OpenGL functions.
///
/// \code
/// sfTransform* transform = ...;
/// glLoadMatrixf(sfTransform_getMatrix(transform));
/// sfTransform transform = ...;
/// float matrix[16];
/// sfTransform_getMatrix(&transform, matrix)
/// glLoadMatrixf(matrix);
/// \endcode
///
/// \param transform Transform object
///
/// \return Pointer to a 4x4 matrix
/// \param matrix Pointer to the 16-element array to fill with the matrix
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const float* sfTransform_getMatrix(const sfTransform* transform);
CSFML_GRAPHICS_API void sfTransform_getMatrix(const sfTransform* transform, float* matrix);
////////////////////////////////////////////////////////////
/// \brief Return the inverse of a transform
@@ -108,10 +98,10 @@ CSFML_GRAPHICS_API const float* sfTransform_getMatrix(const sfTransform* transfo
/// is returned.
///
/// \param transform Transform object
/// \param result Returned inverse matrix
/// \return The inverse matrix
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransform_getInverse(const sfTransform* transform, sfTransform* result);
CSFML_GRAPHICS_API sfTransform sfTransform_getInverse(const sfTransform* transform);
////////////////////////////////////////////////////////////
/// \brief Apply a transform to a 2D point
+3 -2
View File
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/System/Vector2.h>
@@ -200,7 +201,7 @@ CSFML_GRAPHICS_API void sfTransformable_scale(sfTransformable* transformable, sf
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfTransformable_getTransform(const sfTransformable* transformable);
CSFML_GRAPHICS_API sfTransform sfTransformable_getTransform(const sfTransformable* transformable);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a transformable
@@ -210,7 +211,7 @@ CSFML_GRAPHICS_API const sfTransform* sfTransformable_getTransform(const sfTrans
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfTransformable_getInverseTransform(const sfTransformable* transformable);
CSFML_GRAPHICS_API sfTransform sfTransformable_getInverseTransform(const sfTransformable* transformable);
#endif // SFML_TRANSFORMABLE_H
-1
View File
@@ -38,7 +38,6 @@ typedef struct sfShape sfShape;
typedef struct sfSprite sfSprite;
typedef struct sfText sfText;
typedef struct sfTexture sfTexture;
typedef struct sfTransform sfTransform;
typedef struct sfTransformable sfTransformable;
typedef struct sfVertexArray sfVertexArray;
typedef struct sfView sfView;