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

+9 -16
View File
@@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.h>
#include <SFML/System/Vector3.h>
////////////////////////////////////////////////////////////
@@ -56,22 +57,18 @@ CSFML_AUDIO_API float sfListener_GetGlobalVolume(void);
///
/// The default listener's position is (0, 0, 0).
///
/// \param x X coordinate of the listener's position
/// \param y Y coordinate of the listener's position
/// \param z Z coordinate of the listener's position
/// \param position New position of the listener
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfListener_SetPosition(float x, float y, float z);
CSFML_AUDIO_API void sfListener_SetPosition(sfVector3f position);
////////////////////////////////////////////////////////////
/// \brief Get the current position of the listener in the scene
///
/// \param x X coordinate of the listener's position
/// \param y Y coordinate of the listener's position
/// \param z Z coordinate of the listener's position
/// \return The listener's position
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfListener_GetPosition(float* x, float* y, float* z);
CSFML_AUDIO_API sfVector3f sfListener_GetPosition();
////////////////////////////////////////////////////////////
/// \brief Set the orientation of the listener in the scene
@@ -81,22 +78,18 @@ CSFML_AUDIO_API void sfListener_GetPosition(float* x, float* y, float* z);
/// doesn't have to be normalized.
/// The default listener's orientation is (0, 0, -1).
///
/// \param x X coordinate of the listener's orientation
/// \param y Y coordinate of the listener's orientation
/// \param z Z coordinate of the listener's orientation
/// \param position New direction of the listener
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfListener_SetDirection(float x, float y, float z);
CSFML_AUDIO_API void sfListener_SetDirection(sfVector3f orientation);
////////////////////////////////////////////////////////////
/// \brief Get the current orientation of the listener in the scene
///
/// \param x X coordinate of the listener's orientation
/// \param y Y coordinate of the listener's orientation
/// \param z Z coordinate of the listener's orientation
/// \return The listener's direction
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfListener_GetDirection(float* x, float* y, float* z);
CSFML_AUDIO_API sfVector3f sfListener_GetDirection();
#endif // SFML_LISTENER_H
+8 -10
View File
@@ -33,6 +33,7 @@
#include <SFML/Audio/Types.h>
#include <SFML/System/InputStream.h>
#include <SFML/System/Time.h>
#include <SFML/System/Vector3.h>
#include <stddef.h>
@@ -243,13 +244,11 @@ CSFML_AUDIO_API void sfMusic_SetVolume(sfMusic* music, float volume);
/// spatialized.
/// The default position of a music is (0, 0, 0).
///
/// \param music Music object
/// \param x X coordinate of the position of the music in the scene
/// \param y Y coordinate of the position of the music in the scene
/// \param z Z coordinate of the position of the music in the scene
///
/// \param music Music object
/// \param position Position of the music in the scene
//
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfMusic_SetPosition(sfMusic* music, float x, float y, float z);
CSFML_AUDIO_API void sfMusic_SetPosition(sfMusic* music, sfVector3f position);
////////////////////////////////////////////////////////////
/// \brief Make a musics's position relative to the listener or absolute
@@ -336,12 +335,11 @@ CSFML_AUDIO_API float sfMusic_GetVolume(const sfMusic* music);
/// \brief Get the 3D position of a music in the audio scene
///
/// \param music Music object
/// \param x X position of the music in the world
/// \param y Y position of the music in the world
/// \param z Z position of the music in the world
///
/// \return Position of the music in the world
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfMusic_GetPosition(const sfMusic* music, float* x, float* y, float* z);
CSFML_AUDIO_API sfVector3f sfMusic_GetPosition(const sfMusic* music);
////////////////////////////////////////////////////////////
/// \brief Tell whether a music's position is relative to the
+7 -9
View File
@@ -32,6 +32,7 @@
#include <SFML/Audio/SoundStatus.h>
#include <SFML/Audio/Types.h>
#include <SFML/System/Time.h>
#include <SFML/System/Vector3.h>
////////////////////////////////////////////////////////////
@@ -188,13 +189,11 @@ CSFML_AUDIO_API void sfSound_SetVolume(sfSound* sound, float volume);
/// spatialized.
/// The default position of a sound is (0, 0, 0).
///
/// \param sound Sound object
/// \param x X coordinate of the position of the sound in the scene
/// \param y Y coordinate of the position of the sound in the scene
/// \param z Z coordinate of the position of the sound in the scene
/// \param sound Sound object
/// \param position Position of the sound in the scene
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSound_SetPosition(sfSound* sound, float x, float y, float z);
CSFML_AUDIO_API void sfSound_SetPosition(sfSound* sound, sfVector3f position);
////////////////////////////////////////////////////////////
/// \brief Make the sound's position relative to the listener or absolute
@@ -281,12 +280,11 @@ CSFML_AUDIO_API float sfSound_GetVolume(const sfSound* sound);
/// \brief Get the 3D position of a sound in the audio scene
///
/// \param sound Sound object
/// \param x X position of the sound in the world
/// \param y Y position of the sound in the world
/// \param z Z position of the sound in the world
///
/// \return Position of the sound in the world
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSound_GetPosition(const sfSound* sound, float* x, float* y, float* z);
CSFML_AUDIO_API sfVector3f sfSound_GetPosition(const sfSound* sound);
////////////////////////////////////////////////////////////
/// \brief Tell whether a sound's position is relative to the
+6 -8
View File
@@ -32,6 +32,7 @@
#include <SFML/Audio/SoundStatus.h>
#include <SFML/Audio/Types.h>
#include <SFML/System/Time.h>
#include <SFML/System/Vector3.h>
////////////////////////////////////////////////////////////
@@ -181,12 +182,10 @@ CSFML_AUDIO_API void sfSoundStream_SetVolume(sfSoundStream* soundStream, float v
/// The default position of a stream is (0, 0, 0).
///
/// \param soundStream Sound stream object
/// \param x X coordinate of the position of the stream in the scene
/// \param y Y coordinate of the position of the stream in the scene
/// \param z Z coordinate of the position of the stream in the scene
/// \param position Position of the stream in the scene
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_SetPosition(sfSoundStream* soundStream, float x, float y, float z);
CSFML_AUDIO_API void sfSoundStream_SetPosition(sfSoundStream* soundStream, sfVector3f position);
////////////////////////////////////////////////////////////
/// \brief Make a sound stream's position relative to the listener or absolute
@@ -287,12 +286,11 @@ CSFML_AUDIO_API float sfSoundStream_GetVolume(const sfSoundStream* soundStream);
/// \brief Get the 3D position of a sound stream in the audio scene
///
/// \param soundStream Sound stream object
/// \param x X position of the stream in the world
/// \param y Y position of the stream in the world
/// \param z Z position of the stream in the world
///
/// \return Position of the stream in the world
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_GetPosition(const sfSoundStream* soundStream, float* x, float* y, float* z);
CSFML_AUDIO_API sfVector3f sfSoundStream_GetPosition(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Tell whether a sound stream's position is relative to the
+19 -23
View File
@@ -32,6 +32,7 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
@@ -67,12 +68,11 @@ CSFML_GRAPHICS_API void sfCircleShape_Destroy(sfCircleShape* shape);
/// See sfCircleShape_Move to apply an offset based on the previous position instead.
/// 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 sfCircleShape_SetPosition(sfCircleShape* shape, float x, float y);
CSFML_GRAPHICS_API void sfCircleShape_SetPosition(sfCircleShape* shape, sfVector2f position);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of a circle shape
@@ -94,12 +94,11 @@ CSFML_GRAPHICS_API void sfCircleShape_SetRotation(sfCircleShape* shape, float an
/// See sfCircleShape_Scale to add a factor based on the previous scale instead.
/// 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 sfCircleShape_SetScale(sfCircleShape* shape, float factorX, float factorY);
CSFML_GRAPHICS_API void sfCircleShape_SetScale(sfCircleShape* shape, sfVector2f scale);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of a circle shape
@@ -111,12 +110,11 @@ CSFML_GRAPHICS_API void sfCircleShape_SetScale(sfCircleShape* shape, float facto
/// transformations (position, scale, rotation).
/// 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 sfCircleShape_SetOrigin(sfCircleShape* shape, float x, float y);
CSFML_GRAPHICS_API void sfCircleShape_SetOrigin(sfCircleShape* shape, sfVector2f origin);
////////////////////////////////////////////////////////////
/// \brief Get the position of a circle shape
@@ -126,7 +124,7 @@ CSFML_GRAPHICS_API void sfCircleShape_SetOrigin(sfCircleShape* shape, float x, f
/// \return Current position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_GetPosition(const sfCircleShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetPosition(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the orientation of a circle shape
@@ -148,7 +146,7 @@ CSFML_GRAPHICS_API float sfCircleShape_GetRotation(const sfCircleShape* shape);
/// \return Current scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_GetScale(const sfCircleShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetScale(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the local origin of a circle shape
@@ -158,7 +156,7 @@ CSFML_GRAPHICS_API void sfCircleShape_GetScale(const sfCircleShape* shape, float
/// \return Current origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_GetOrigin(const sfCircleShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetOrigin(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Move a circle shape by a given offset
@@ -166,12 +164,11 @@ CSFML_GRAPHICS_API void sfCircleShape_GetOrigin(const sfCircleShape* shape, floa
/// This function adds to the current position of the object,
/// unlike sfCircleShape_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 sfCircleShape_Move(sfCircleShape* shape, float offsetX, float offsetY);
CSFML_GRAPHICS_API void sfCircleShape_Move(sfCircleShape* shape, sfVector2f offset);
////////////////////////////////////////////////////////////
/// \brief Rotate a circle shape
@@ -192,11 +189,10 @@ CSFML_GRAPHICS_API void sfCircleShape_Rotate(sfCircleShape* shape, float angle);
/// unlike sfCircleShape_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 sfCircleShape_Scale(sfCircleShape* shape, float factorX, float factorY);
CSFML_GRAPHICS_API void sfCircleShape_Scale(sfCircleShape* shape, sfVector2f factors);
////////////////////////////////////////////////////////////
/// \brief Get the combined transform of a circle shape
@@ -368,7 +364,7 @@ CSFML_GRAPHICS_API unsigned int sfCircleShape_GetPointCount(const sfCircleShape*
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_GetPoint(const sfCircleShape* shape, unsigned int index, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetPoint(const sfCircleShape* shape, unsigned int index);
////////////////////////////////////////////////////////////
/// \brief Set the radius of a circle
+25 -30
View File
@@ -32,6 +32,7 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
@@ -65,21 +66,20 @@ CSFML_GRAPHICS_API void sfConvexShape_Destroy(sfConvexShape* shape);
///
/// This function completely overwrites the previous position.
/// See sfConvexShape_Move to apply an offset based on the previous position instead.
/// The default position of a convex 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 sfConvexShape_SetPosition(sfConvexShape* shape, float x, float y);
CSFML_GRAPHICS_API void sfConvexShape_SetPosition(sfConvexShape* shape, sfVector2f position);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of a convex shape
///
/// This function completely overwrites the previous rotation.
/// See sfConvexShape_Rotate to add an angle based on the previous rotation instead.
/// The default rotation of a convex shape object is 0.
/// The default rotation of a circle Shape object is 0.
///
/// \param shape Shape object
/// \param angle New rotation, in degrees
@@ -92,14 +92,13 @@ CSFML_GRAPHICS_API void sfConvexShape_SetRotation(sfConvexShape* shape, float an
///
/// This function completely overwrites the previous scale.
/// See sfConvexShape_Scale to add a factor based on the previous scale instead.
/// The default scale of a convex 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 sfConvexShape_SetScale(sfConvexShape* shape, float factorX, float factorY);
CSFML_GRAPHICS_API void sfConvexShape_SetScale(sfConvexShape* shape, sfVector2f scale);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of a convex shape
@@ -109,14 +108,13 @@ CSFML_GRAPHICS_API void sfConvexShape_SetScale(sfConvexShape* shape, float facto
/// 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 convex 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 sfConvexShape_SetOrigin(sfConvexShape* shape, float x, float y);
CSFML_GRAPHICS_API void sfConvexShape_SetOrigin(sfConvexShape* shape, sfVector2f origin);
////////////////////////////////////////////////////////////
/// \brief Get the position of a convex shape
@@ -126,7 +124,7 @@ CSFML_GRAPHICS_API void sfConvexShape_SetOrigin(sfConvexShape* shape, float x, f
/// \return Current position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_GetPosition(const sfConvexShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfConvexShape_GetPosition(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the orientation of a convex shape
@@ -148,7 +146,7 @@ CSFML_GRAPHICS_API float sfConvexShape_GetRotation(const sfConvexShape* shape);
/// \return Current scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_GetScale(const sfConvexShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfConvexShape_GetScale(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the local origin of a convex shape
@@ -158,7 +156,7 @@ CSFML_GRAPHICS_API void sfConvexShape_GetScale(const sfConvexShape* shape, float
/// \return Current origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_GetOrigin(const sfConvexShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfConvexShape_GetOrigin(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Move a convex shape by a given offset
@@ -166,12 +164,11 @@ CSFML_GRAPHICS_API void sfConvexShape_GetOrigin(const sfConvexShape* shape, floa
/// This function adds to the current position of the object,
/// unlike sfConvexShape_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 sfConvexShape_Move(sfConvexShape* shape, float offsetX, float offsetY);
CSFML_GRAPHICS_API void sfConvexShape_Move(sfConvexShape* shape, sfVector2f offset);
////////////////////////////////////////////////////////////
/// \brief Rotate a convex shape
@@ -192,11 +189,10 @@ CSFML_GRAPHICS_API void sfConvexShape_Rotate(sfConvexShape* shape, float angle);
/// unlike sfConvexShape_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 sfConvexShape_Scale(sfConvexShape* shape, float factorX, float factorY);
CSFML_GRAPHICS_API void sfConvexShape_Scale(sfConvexShape* shape, sfVector2f factors);
////////////////////////////////////////////////////////////
/// \brief Get the combined transform of a convex shape
@@ -368,7 +364,7 @@ CSFML_GRAPHICS_API unsigned int sfConvexShape_GetPointCount(const sfConvexShape*
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_GetPoint(const sfConvexShape* shape, unsigned int index, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfConvexShape_GetPoint(const sfConvexShape* shape, unsigned int index);
////////////////////////////////////////////////////////////
/// \brief Set the number of points of a convex shap
@@ -392,11 +388,10 @@ CSFML_GRAPHICS_API void sfConvexShape_SetPointCount(sfConvexShape* shape, unsign
///
/// \param shape Shape object
/// \param index Index of the point to change, in range [0 .. GetPointCount() - 1]
/// \param x New X coordinate of the point
/// \param y New Y coordinate of the point
/// \param point New point
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_SetPoint(sfConvexShape* shape, unsigned int index, float x, float y);
CSFML_GRAPHICS_API void sfConvexShape_SetPoint(sfConvexShape* shape, unsigned int index, sfVector2f point);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a convex shape
+30 -35
View File
@@ -32,6 +32,7 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
@@ -65,21 +66,20 @@ CSFML_GRAPHICS_API void sfRectangleShape_Destroy(sfRectangleShape* shape);
///
/// This function completely overwrites the previous position.
/// See sfRectangleShape_Move to apply an offset based on the previous position instead.
/// The default position of a rectangle 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 sfRectangleShape_SetPosition(sfRectangleShape* shape, float x, float y);
CSFML_GRAPHICS_API void sfRectangleShape_SetPosition(sfRectangleShape* shape, sfVector2f position);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of a rectangle shape
///
/// This function completely overwrites the previous rotation.
/// See sfRectangleShape_Rotate to add an angle based on the previous rotation instead.
/// The default rotation of a rectangle shape object is 0.
/// The default rotation of a circle Shape object is 0.
///
/// \param shape Shape object
/// \param angle New rotation, in degrees
@@ -92,14 +92,13 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetRotation(sfRectangleShape* shape, fl
///
/// This function completely overwrites the previous scale.
/// See sfRectangleShape_Scale to add a factor based on the previous scale instead.
/// The default scale of a rectangle 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 sfRectangleShape_SetScale(sfRectangleShape* shape, float factorX, float factorY);
CSFML_GRAPHICS_API void sfRectangleShape_SetScale(sfRectangleShape* shape, sfVector2f scale);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of a rectangle shape
@@ -109,14 +108,13 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetScale(sfRectangleShape* shape, float
/// 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 rectangle 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 sfRectangleShape_SetOrigin(sfRectangleShape* shape, float x, float y);
CSFML_GRAPHICS_API void sfRectangleShape_SetOrigin(sfRectangleShape* shape, sfVector2f origin);
////////////////////////////////////////////////////////////
/// \brief Get the position of a rectangle shape
@@ -126,7 +124,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetOrigin(sfRectangleShape* shape, floa
/// \return Current position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_GetPosition(const sfRectangleShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetPosition(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the orientation of a rectangle shape
@@ -148,7 +146,7 @@ CSFML_GRAPHICS_API float sfRectangleShape_GetRotation(const sfRectangleShape* sh
/// \return Current scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_GetScale(const sfRectangleShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetScale(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the local origin of a rectangle shape
@@ -158,7 +156,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_GetScale(const sfRectangleShape* shape,
/// \return Current origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_GetOrigin(const sfRectangleShape* shape, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetOrigin(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Move a rectangle shape by a given offset
@@ -166,12 +164,11 @@ CSFML_GRAPHICS_API void sfRectangleShape_GetOrigin(const sfRectangleShape* shape
/// This function adds to the current position of the object,
/// unlike sfRectangleShape_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 sfRectangleShape_Move(sfRectangleShape* shape, float offsetX, float offsetY);
CSFML_GRAPHICS_API void sfRectangleShape_Move(sfRectangleShape* shape, sfVector2f offset);
////////////////////////////////////////////////////////////
/// \brief Rotate a rectangle shape
@@ -192,11 +189,10 @@ CSFML_GRAPHICS_API void sfRectangleShape_Rotate(sfRectangleShape* shape, float a
/// unlike sfRectangleShape_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 sfRectangleShape_Scale(sfRectangleShape* shape, float factorX, float factorY);
CSFML_GRAPHICS_API void sfRectangleShape_Scale(sfRectangleShape* shape, sfVector2f factors);
////////////////////////////////////////////////////////////
/// \brief Get the combined transform of a rectangle shape
@@ -368,27 +364,26 @@ CSFML_GRAPHICS_API unsigned int sfRectangleShape_GetPointCount(const sfRectangle
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_GetPoint(const sfRectangleShape* shape, unsigned int index, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetPoint(const sfRectangleShape* shape, unsigned int index);
////////////////////////////////////////////////////////////
/// \brief Set the size of a rectangle shape
///
/// \param shape Shape object
/// \param width New width of the rectangle
/// \param height New height of the rectangle
/// \param shape Shape object
/// \param size New size of the rectangle
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_SetSize(sfRectangleShape* shape, float width, float height);
CSFML_GRAPHICS_API void sfRectangleShape_SetSize(sfRectangleShape* shape, sfVector2f size);
////////////////////////////////////////////////////////////
/// \brief Get the size of a rectangle shape
///
/// \param shape Shape object
/// \param width Returned width of the rectangle
/// \param height Returned height of the rectangle
/// \param shape Shape object
//
/// \return height Size of the rectangle
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_GetSize(const sfRectangleShape* shape, float* width, float* height);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetSize(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a rectangle shape
+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
+21 -25
View File
@@ -33,6 +33,7 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
@@ -66,21 +67,20 @@ CSFML_GRAPHICS_API void sfSprite_Destroy(sfSprite* sprite);
///
/// This function completely overwrites the previous position.
/// See sfSprite_Move to apply an offset based on the previous position instead.
/// The default position of a sprite object is (0, 0).
/// The default position of a sprite Sprite object is (0, 0).
///
/// \param sprite Sprite object
/// \param x X coordinate of the new position
/// \param y Y coordinate of the new position
/// \param sprite Sprite object
/// \param position New position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfSprite_SetPosition(sfSprite* sprite, float x, float y);
CSFML_GRAPHICS_API void sfSprite_SetPosition(sfSprite* sprite, sfVector2f position);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of a sprite
///
/// This function completely overwrites the previous rotation.
/// See sfSprite_Rotate to add an angle based on the previous rotation instead.
/// The default rotation of a sprite object is 0.
/// The default rotation of a sprite Sprite object is 0.
///
/// \param sprite Sprite object
/// \param angle New rotation, in degrees
@@ -93,14 +93,13 @@ CSFML_GRAPHICS_API void sfSprite_SetRotation(sfSprite* sprite, float angle);
///
/// This function completely overwrites the previous scale.
/// See sfSprite_Scale to add a factor based on the previous scale instead.
/// The default scale of a sprite object is (1, 1).
/// The default scale of a sprite Sprite object is (1, 1).
///
/// \param sprite Sprite object
/// \param factorX New horizontal scale factor
/// \param factorY New vertical scale factor
/// \param sprite Sprite object
/// \param scale New scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfSprite_SetScale(sfSprite* sprite, float factorX, float factorY);
CSFML_GRAPHICS_API void sfSprite_SetScale(sfSprite* sprite, sfVector2f scale);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of a sprite
@@ -110,14 +109,13 @@ CSFML_GRAPHICS_API void sfSprite_SetScale(sfSprite* sprite, float factorX, float
/// 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 sprite object is (0, 0).
/// The default origin of a sprite Sprite object is (0, 0).
///
/// \param sprite Sprite object
/// \param x X coordinate of the new origin
/// \param y Y coordinate of the new origin
/// \param origin New origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfSprite_SetOrigin(sfSprite* sprite, float x, float y);
CSFML_GRAPHICS_API void sfSprite_SetOrigin(sfSprite* sprite, sfVector2f origin);
////////////////////////////////////////////////////////////
/// \brief Get the position of a sprite
@@ -127,7 +125,7 @@ CSFML_GRAPHICS_API void sfSprite_SetOrigin(sfSprite* sprite, float x, float y);
/// \return Current position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfSprite_GetPosition(const sfSprite* sprite, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfSprite_GetPosition(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// \brief Get the orientation of a sprite
@@ -149,7 +147,7 @@ CSFML_GRAPHICS_API float sfSprite_GetRotation(const sfSprite* sprite);
/// \return Current scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfSprite_GetScale(const sfSprite* sprite, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfSprite_GetScale(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// \brief Get the local origin of a sprite
@@ -159,7 +157,7 @@ CSFML_GRAPHICS_API void sfSprite_GetScale(const sfSprite* sprite, float* x, floa
/// \return Current origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfSprite_GetOrigin(const sfSprite* sprite, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfSprite_GetOrigin(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// \brief Move a sprite by a given offset
@@ -167,12 +165,11 @@ CSFML_GRAPHICS_API void sfSprite_GetOrigin(const sfSprite* sprite, float* x, flo
/// This function adds to the current position of the object,
/// unlike sfSprite_SetPosition which overwrites it.
///
/// \param sprite Sprite object
/// \param offsetX X offset
/// \param offsetY Y offset
/// \param sprite Sprite object
/// \param offset Offset
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfSprite_Move(sfSprite* sprite, float offsetX, float offsetY);
CSFML_GRAPHICS_API void sfSprite_Move(sfSprite* sprite, sfVector2f offset);
////////////////////////////////////////////////////////////
/// \brief Rotate a sprite
@@ -193,11 +190,10 @@ CSFML_GRAPHICS_API void sfSprite_Rotate(sfSprite* sprite, float angle);
/// unlike sfSprite_SetScale which overwrites it.
///
/// \param sprite Sprite object
/// \param factorX Horizontal scale factor
/// \param factorY Vertical scale factor
/// \param factors Scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfSprite_Scale(sfSprite* sprite, float factorX, float factorY);
CSFML_GRAPHICS_API void sfSprite_Scale(sfSprite* sprite, sfVector2f factors);
////////////////////////////////////////////////////////////
/// \brief Get the combined transform of a sprite
+26 -30
View File
@@ -32,6 +32,7 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
@@ -78,21 +79,20 @@ CSFML_GRAPHICS_API void sfText_Destroy(sfText* text);
///
/// This function completely overwrites the previous position.
/// See sfText_Move to apply an offset based on the previous position instead.
/// The default position of a text object is (0, 0).
/// The default position of a text Text object is (0, 0).
///
/// \param text Text object
/// \param x X coordinate of the new position
/// \param y Y coordinate of the new position
/// \param text Text object
/// \param position New position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_SetPosition(sfText* text, float x, float y);
CSFML_GRAPHICS_API void sfText_SetPosition(sfText* text, sfVector2f position);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of a text
///
/// This function completely overwrites the previous rotation.
/// See sfText_Rotate to add an angle based on the previous rotation instead.
/// The default rotation of a text object is 0.
/// The default rotation of a text Text object is 0.
///
/// \param text Text object
/// \param angle New rotation, in degrees
@@ -105,14 +105,13 @@ CSFML_GRAPHICS_API void sfText_SetRotation(sfText* text, float angle);
///
/// This function completely overwrites the previous scale.
/// See sfText_Scale to add a factor based on the previous scale instead.
/// The default scale of a text object is (1, 1).
/// The default scale of a text Text object is (1, 1).
///
/// \param text Text object
/// \param factorX New horizontal scale factor
/// \param factorY New vertical scale factor
/// \param text Text object
/// \param scale New scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_SetScale(sfText* text, float factorX, float factorY);
CSFML_GRAPHICS_API void sfText_SetScale(sfText* text, sfVector2f scale);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of a text
@@ -122,14 +121,13 @@ CSFML_GRAPHICS_API void sfText_SetScale(sfText* text, float factorX, float facto
/// 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 text object is (0, 0).
/// The default origin of a text Text object is (0, 0).
///
/// \param text Text object
/// \param x X coordinate of the new origin
/// \param y Y coordinate of the new origin
/// \param text Text object
/// \param origin New origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_SetOrigin(sfText* text, float x, float y);
CSFML_GRAPHICS_API void sfText_SetOrigin(sfText* text, sfVector2f origin);
////////////////////////////////////////////////////////////
/// \brief Get the position of a text
@@ -139,7 +137,7 @@ CSFML_GRAPHICS_API void sfText_SetOrigin(sfText* text, float x, float y);
/// \return Current position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_GetPosition(const sfText* text, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfText_GetPosition(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the orientation of a text
@@ -161,7 +159,7 @@ CSFML_GRAPHICS_API float sfText_GetRotation(const sfText* text);
/// \return Current scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_GetScale(const sfText* text, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfText_GetScale(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the local origin of a text
@@ -171,7 +169,7 @@ CSFML_GRAPHICS_API void sfText_GetScale(const sfText* text, float* x, float* y);
/// \return Current origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_GetOrigin(const sfText* text, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfText_GetOrigin(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Move a text by a given offset
@@ -179,12 +177,11 @@ CSFML_GRAPHICS_API void sfText_GetOrigin(const sfText* text, float* x, float* y)
/// This function adds to the current position of the object,
/// unlike sfText_SetPosition which overwrites it.
///
/// \param text Text object
/// \param offsetX X offset
/// \param offsetY Y offset
/// \param text Text object
/// \param offset Offset
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_Move(sfText* text, float offsetX, float offsetY);
CSFML_GRAPHICS_API void sfText_Move(sfText* text, sfVector2f offset);
////////////////////////////////////////////////////////////
/// \brief Rotate a text
@@ -205,11 +202,10 @@ CSFML_GRAPHICS_API void sfText_Rotate(sfText* text, float angle);
/// unlike sfText_SetScale which overwrites it.
///
/// \param text Text object
/// \param factorX Horizontal scale factor
/// \param factorY Vertical scale factor
/// \param factors Scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_Scale(sfText* text, float factorX, float factorY);
CSFML_GRAPHICS_API void sfText_Scale(sfText* text, sfVector2f factors);
////////////////////////////////////////////////////////////
/// \brief Get the combined transform of a text
@@ -376,11 +372,11 @@ CSFML_GRAPHICS_API sfColor sfText_GetColor(const sfText* text);
///
/// \param text Text object
/// \param index Index of the character
/// \param x The returned x position of the character
/// \param y The returned y position of the character
///
/// \return Position of the character
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_FindCharacterPos(const sfText* text, size_t index, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfText_FindCharacterPos(const sfText* text, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a text
@@ -405,7 +401,7 @@ CSFML_GRAPHICS_API sfFloatRect sfText_GetLocalBounds(const sfText* text);
/// that it takes in account the transformations (translation,
/// rotation, scale, ...) that are applied to the entity.
/// In other words, this function returns the bounds of the
/// sprite in the global 2D world's coordinate system.
/// text in the global 2D world's coordinate system.
///
/// \param text Text object
///
+2 -2
View File
@@ -60,8 +60,8 @@ CSFML_GRAPHICS_API sfTransform* sfTransform_Create(void);
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTransform* sfTransform_CreateFromMatrix(float a00, float a01, float a02,
float a10, float a11, float a12,
float a20, float a21, float a22);
float a10, float a11, float a12,
float a20, float a21, float a22);
////////////////////////////////////////////////////////////
/// \brief Copy an existing transform
+18 -22
View File
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
@@ -63,21 +64,20 @@ CSFML_GRAPHICS_API void sfTransformable_Destroy(sfTransformable* transformable);
///
/// This function completely overwrites the previous position.
/// See sfTransformable_Move to apply an offset based on the previous position instead.
/// The default position of a transformable object is (0, 0).
/// The default position of a transformable Transformable object is (0, 0).
///
/// \param transformable Transformable object
/// \param x X coordinate of the new position
/// \param y Y coordinate of the new position
/// \param position New position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransformable_SetPosition(sfTransformable* transformable, float x, float y);
CSFML_GRAPHICS_API void sfTransformable_SetPosition(sfTransformable* transformable, sfVector2f position);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of a transformable
///
/// This function completely overwrites the previous rotation.
/// See sfTransformable_Rotate to add an angle based on the previous rotation instead.
/// The default rotation of a transformable object is 0.
/// The default rotation of a transformable Transformable object is 0.
///
/// \param transformable Transformable object
/// \param angle New rotation, in degrees
@@ -90,14 +90,13 @@ CSFML_GRAPHICS_API void sfTransformable_SetRotation(sfTransformable* transformab
///
/// This function completely overwrites the previous scale.
/// See sfTransformable_Scale to add a factor based on the previous scale instead.
/// The default scale of a transformable object is (1, 1).
/// The default scale of a transformable Transformable object is (1, 1).
///
/// \param transformable Transformable object
/// \param factorX New horizontal scale factor
/// \param factorY New vertical scale factor
/// \param scale New scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransformable_SetScale(sfTransformable* transformable, float factorX, float factorY);
CSFML_GRAPHICS_API void sfTransformable_SetScale(sfTransformable* transformable, sfVector2f scale);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of a transformable
@@ -107,14 +106,13 @@ CSFML_GRAPHICS_API void sfTransformable_SetScale(sfTransformable* transformable,
/// 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 transformable object is (0, 0).
/// The default origin of a transformable Transformable object is (0, 0).
///
/// \param transformable Transformable object
/// \param x X coordinate of the new origin
/// \param y Y coordinate of the new origin
/// \param origin New origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransformable_SetOrigin(sfTransformable* transformable, float x, float y);
CSFML_GRAPHICS_API void sfTransformable_SetOrigin(sfTransformable* transformable, sfVector2f origin);
////////////////////////////////////////////////////////////
/// \brief Get the position of a transformable
@@ -124,7 +122,7 @@ CSFML_GRAPHICS_API void sfTransformable_SetOrigin(sfTransformable* transformable
/// \return Current position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransformable_GetPosition(const sfTransformable* transformable, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfTransformable_GetPosition(const sfTransformable* transformable);
////////////////////////////////////////////////////////////
/// \brief Get the orientation of a transformable
@@ -146,7 +144,7 @@ CSFML_GRAPHICS_API float sfTransformable_GetRotation(const sfTransformable* tran
/// \return Current scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransformable_GetScale(const sfTransformable* transformable, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfTransformable_GetScale(const sfTransformable* transformable);
////////////////////////////////////////////////////////////
/// \brief Get the local origin of a transformable
@@ -156,7 +154,7 @@ CSFML_GRAPHICS_API void sfTransformable_GetScale(const sfTransformable* transfor
/// \return Current origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransformable_GetOrigin(const sfTransformable* transformable, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfTransformable_GetOrigin(const sfTransformable* transformable);
////////////////////////////////////////////////////////////
/// \brief Move a transformable by a given offset
@@ -165,11 +163,10 @@ CSFML_GRAPHICS_API void sfTransformable_GetOrigin(const sfTransformable* transfo
/// unlike sfTransformable_SetPosition which overwrites it.
///
/// \param transformable Transformable object
/// \param offsetX X offset
/// \param offsetY Y offset
/// \param offset Offset
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransformable_Move(sfTransformable* transformable, float offsetX, float offsetY);
CSFML_GRAPHICS_API void sfTransformable_Move(sfTransformable* transformable, sfVector2f offset);
////////////////////////////////////////////////////////////
/// \brief Rotate a transformable
@@ -190,11 +187,10 @@ CSFML_GRAPHICS_API void sfTransformable_Rotate(sfTransformable* transformable, f
/// unlike sfTransformable_SetScale which overwrites it.
///
/// \param transformable Transformable object
/// \param factorX Horizontal scale factor
/// \param factorY Vertical scale factor
/// \param factors Scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransformable_Scale(sfTransformable* transformable, float factorX, float factorY);
CSFML_GRAPHICS_API void sfTransformable_Scale(sfTransformable* transformable, sfVector2f factors);
////////////////////////////////////////////////////////////
/// \brief Get the combined transform of a transformable
+17 -19
View File
@@ -31,6 +31,7 @@
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
@@ -74,22 +75,20 @@ CSFML_GRAPHICS_API void sfView_Destroy(sfView* view);
////////////////////////////////////////////////////////////
/// \brief Set the center of a view
///
/// \param view View object
/// \param x X coordinate of the new center
/// \param y Y coordinate of the new center
/// \param view View object
/// \param center New center
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfView_SetCenter(sfView* view, float x, float y);
CSFML_GRAPHICS_API void sfView_SetCenter(sfView* view, sfVector2f center);
////////////////////////////////////////////////////////////
/// \brief Set the size of a view
///
/// \param view View object
/// \param width New width of the view
/// \param height New height of the view
/// \param view View object
/// \param size New size of the view
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfView_SetSize(sfView* view, float width, float height);
CSFML_GRAPHICS_API void sfView_SetSize(sfView* view, sfVector2f size);
////////////////////////////////////////////////////////////
/// \brief Set the orientation of a view
@@ -133,21 +132,21 @@ CSFML_GRAPHICS_API void sfView_Reset(sfView* view, sfFloatRect rectangle);
/// \brief Get the center of a view
///
/// \param view View object
/// \param x Returned X coordinate of the center
/// \param y Returned Y coordinate of the center
///
/// \return Center of the view
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfView_GetCenter(const sfView* view, float* x, float* y);
CSFML_GRAPHICS_API sfVector2f sfView_GetCenter(const sfView* view);
////////////////////////////////////////////////////////////
/// \brief Get the size of a view
///
/// \param view View object
/// \param width Returned width
/// \param height Returned height
/// \param view View object
///
/// \return Size of the view
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfView_GetSize(const sfView* view, float* width, float* height);
CSFML_GRAPHICS_API sfVector2f sfView_GetSize(const sfView* view);
////////////////////////////////////////////////////////////
/// \brief Get the current orientation of a view
@@ -172,12 +171,11 @@ CSFML_GRAPHICS_API sfFloatRect sfView_GetViewport(const sfView* view);
////////////////////////////////////////////////////////////
/// \brief Move a view relatively to its current position
///
/// \param view View object
/// \param offsetX X coordinate of the move offset
/// \param offsetY Y coordinate of the move offset
/// \param view View object
/// \param offset Offset
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfView_Move(sfView* view, float offsetX, float offsetY);
CSFML_GRAPHICS_API void sfView_Move(sfView* view, sfVector2f offset);
////////////////////////////////////////////////////////////
/// \brief Rotate a view relatively to its current orientation
+6 -6
View File
@@ -29,6 +29,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Window/Export.h>
#include <SFML/Window/Types.h>
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
@@ -63,12 +64,12 @@ CSFML_WINDOW_API sfBool sfMouse_IsButtonPressed(sfMouseButton button);
/// This function returns the current position of the mouse
/// cursor relative to the given window, or desktop if NULL is passed.
///
/// \param x Variable to fill with the current X position of the mouse
/// \param y Variable to fill with the current Y position of the mouse
/// \param relativeTo Reference window
///
/// \return Position of the mouse cursor, relative to the given window
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfMouse_GetPosition(int* x, int* y, const sfWindow* relativeTo);
CSFML_WINDOW_API sfVector2i sfMouse_GetPosition(const sfWindow* relativeTo);
////////////////////////////////////////////////////////////
/// \brief Set the current position of the mouse
@@ -76,12 +77,11 @@ CSFML_WINDOW_API void sfMouse_GetPosition(int* x, int* y, const sfWindow* relati
/// This function sets the current position of the mouse
/// cursor relative to the given window, or desktop if NULL is passed.
///
/// \param x New X position of the mouse
/// \param y New Y position of the mouse
/// \param position New position of the mouse
/// \param relativeTo Reference window
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfMouse_SetPosition(int x, int y, const sfWindow* relativeTo);
CSFML_WINDOW_API void sfMouse_SetPosition(sfVector2i position, const sfWindow* relativeTo);
#endif // SFML_MOUSE_H