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
+12 -20
View File
@@ -45,40 +45,32 @@ float sfListener_GetGlobalVolume(void)
////////////////////////////////////////////////////////////
void sfListener_SetPosition(float x, float y, float z)
void sfListener_SetPosition(sfVector3f position)
{
sf::Listener::SetPosition(x, y, z);
sf::Listener::SetPosition(position.x, position.y, position.z);
}
////////////////////////////////////////////////////////////
void sfListener_GetPosition(float* x, float* y, float* z)
sfVector3f sfListener_GetPosition()
{
if (x && y && z)
{
sf::Vector3f position = sf::Listener::GetPosition();
*x = position.x;
*y = position.y;
*z = position.z;
}
sf::Vector3f sfmlPos = sf::Listener::GetPosition();
sfVector3f position = {sfmlPos.x, sfmlPos.y, sfmlPos.z};
return position;
}
////////////////////////////////////////////////////////////
void sfListener_SetDirection(float x, float y, float z)
void sfListener_SetDirection(sfVector3f direction)
{
sf::Listener::SetDirection(x, y, z);
sf::Listener::SetDirection(direction.x, direction.y, direction.z);
}
////////////////////////////////////////////////////////////
void sfListener_GetDirection(float* x, float* y, float* z)
sfVector3f sfListener_GetDirection()
{
if (x && y && z)
{
sf::Vector3f direction = sf::Listener::GetDirection();
*x = direction.x;
*y = direction.y;
*z = direction.z;
}
sf::Vector3f sfmlDirection = sf::Listener::GetDirection();
sfVector3f direction = {sfmlDirection.x, sfmlDirection.y, sfmlDirection.z};
return direction;
}
+11 -11
View File
@@ -177,9 +177,9 @@ void sfMusic_SetVolume(sfMusic* music, float volume)
////////////////////////////////////////////////////////////
void sfMusic_SetPosition(sfMusic* music, float x, float y, float z)
void sfMusic_SetPosition(sfMusic* music, sfVector3f position)
{
CSFML_CALL(music, SetPosition(sf::Vector3f(x, y, z)));
CSFML_CALL(music, SetPosition(sf::Vector3f(position.x, position.y, position.z)));
}
@@ -226,17 +226,17 @@ float sfMusic_GetVolume(const sfMusic* music)
////////////////////////////////////////////////////////////
void sfMusic_GetPosition(const sfMusic* music, float* x, float* y, float* z)
sfVector3f sfMusic_GetPosition(const sfMusic* music)
{
CSFML_CHECK(music);
sfVector3f position = {0, 0, 0};
CSFML_CHECK_RETURN(music, position);
if (x && y && z)
{
sf::Vector3f position = music->This.GetPosition();
*x = position.x;
*y = position.y;
*z = position.z;
}
sf::Vector3f sfmlPos = music->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
position.z = sfmlPos.z;
return position;
}
+11 -8
View File
@@ -132,9 +132,9 @@ void sfSound_SetVolume(sfSound* sound, float volume)
////////////////////////////////////////////////////////////
void sfSound_SetPosition(sfSound* sound, float x, float y, float z)
void sfSound_SetPosition(sfSound* sound, sfVector3f position)
{
CSFML_CALL(sound, SetPosition(sf::Vector3f(x, y, z)));
CSFML_CALL(sound, SetPosition(sf::Vector3f(position.x, position.y, position.z)));
}
@@ -181,14 +181,17 @@ float sfSound_GetVolume(const sfSound* sound)
////////////////////////////////////////////////////////////
void sfSound_GetPosition(const sfSound* sound, float* x, float* y, float* z)
sfVector3f sfSound_GetPosition(const sfSound* sound)
{
CSFML_CHECK(sound);
sfVector3f position = {0, 0, 0};
CSFML_CHECK_RETURN(sound, position);
sf::Vector3f position = sound->This.GetPosition();
if (x) *x = position.x;
if (y) *y = position.y;
if (z) *z = position.z;
sf::Vector3f sfmlPos = sound->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
position.z = sfmlPos.z;
return position;
}
+11 -8
View File
@@ -107,9 +107,9 @@ void sfSoundStream_SetVolume(sfSoundStream* soundStream, float volume)
////////////////////////////////////////////////////////////
void sfSoundStream_SetPosition(sfSoundStream* soundStream, float x, float y, float z)
void sfSoundStream_SetPosition(sfSoundStream* soundStream, sfVector3f position)
{
CSFML_CALL(soundStream, SetPosition(x, y, z));
CSFML_CALL(soundStream, SetPosition(position.x, position.y, position.z));
}
@@ -163,14 +163,17 @@ float sfSoundStream_GetVolume(const sfSoundStream* soundStream)
////////////////////////////////////////////////////////////
void sfSoundStream_GetPosition(const sfSoundStream* soundStream, float* x, float* y, float* z)
sfVector3f sfSoundStream_GetPosition(const sfSoundStream* soundStream)
{
CSFML_CHECK(soundStream);
sfVector3f position = {0, 0, 0};
CSFML_CHECK_RETURN(soundStream, position);
sf::Vector3f position = soundStream->This.GetPosition();
if (x) *x = position.x;
if (y) *y = position.y;
if (z) *z = position.z;
sf::Vector3f sfmlPos = soundStream->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
position.z = sfmlPos.z;
return position;
}
+39 -38
View File
@@ -58,9 +58,9 @@ void sfCircleShape_Destroy(sfCircleShape* shape)
////////////////////////////////////////////////////////////
void sfCircleShape_SetPosition(sfCircleShape* shape, float x, float y)
void sfCircleShape_SetPosition(sfCircleShape* shape, sfVector2f position)
{
CSFML_CALL(shape, SetPosition(x, y));
CSFML_CALL(shape, SetPosition(position.x, position.y));
}
@@ -72,30 +72,30 @@ void sfCircleShape_SetRotation(sfCircleShape* shape, float angle)
////////////////////////////////////////////////////////////
void sfCircleShape_SetScale(sfCircleShape* shape, float factorX, float factorY)
void sfCircleShape_SetScale(sfCircleShape* shape, sfVector2f scale)
{
CSFML_CALL(shape, SetScale(factorX, factorY));
CSFML_CALL(shape, SetScale(scale.x, scale.y));
}
////////////////////////////////////////////////////////////
void sfCircleShape_SetOrigin(sfCircleShape* shape, float x, float y)
void sfCircleShape_SetOrigin(sfCircleShape* shape, sfVector2f origin)
{
CSFML_CALL(shape, SetOrigin(x, y));
CSFML_CALL(shape, SetOrigin(origin.x, origin.y));
}
////////////////////////////////////////////////////////////
void sfCircleShape_GetPosition(const sfCircleShape* shape, float* x, float* y)
sfVector2f sfCircleShape_GetPosition(const sfCircleShape* shape)
{
CSFML_CHECK(shape);
sfVector2f position = {0, 0};
CSFML_CHECK_RETURN(shape, position);
sf::Vector2f point = shape->This.GetPosition();
sf::Vector2f sfmlPos = shape->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return position;
}
@@ -107,37 +107,37 @@ float sfCircleShape_GetRotation(const sfCircleShape* shape)
////////////////////////////////////////////////////////////
void sfCircleShape_GetScale(const sfCircleShape* shape, float* x, float* y)
sfVector2f sfCircleShape_GetScale(const sfCircleShape* shape)
{
CSFML_CHECK(shape);
sfVector2f scale = {0, 0};
CSFML_CHECK_RETURN(shape, scale);
sf::Vector2f point = shape->This.GetScale();
sf::Vector2f sfmlScale = shape->This.GetScale();
scale.x = sfmlScale.x;
scale.y = sfmlScale.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return scale;
}
////////////////////////////////////////////////////////////
void sfCircleShape_GetOrigin(const sfCircleShape* shape, float* x, float* y)
sfVector2f sfCircleShape_GetOrigin(const sfCircleShape* shape)
{
CSFML_CHECK(shape);
sfVector2f origin = {0, 0};
CSFML_CHECK_RETURN(shape, origin);
sf::Vector2f point = shape->This.GetOrigin();
sf::Vector2f sfmlOrigin = shape->This.GetOrigin();
origin.x = sfmlOrigin.x;
origin.y = sfmlOrigin.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return origin;
}
////////////////////////////////////////////////////////////
void sfCircleShape_Move(sfCircleShape* shape, float offsetX, float offsetY)
void sfCircleShape_Move(sfCircleShape* shape, sfVector2f offset)
{
CSFML_CALL(shape, Move(offsetX, offsetY));
CSFML_CALL(shape, Move(offset.x, offset.y));
}
@@ -149,9 +149,9 @@ void sfCircleShape_Rotate(sfCircleShape* shape, float angle)
////////////////////////////////////////////////////////////
void sfCircleShape_Scale(sfCircleShape* shape, float factorX, float factorY)
void sfCircleShape_Scale(sfCircleShape* shape, sfVector2f factors)
{
CSFML_CALL(shape, Scale(factorX, factorY));
CSFML_CALL(shape, Scale(factors.x, factors.y));
}
@@ -283,15 +283,16 @@ unsigned int sfCircleShape_GetPointCount(const sfCircleShape* shape)
////////////////////////////////////////////////////////////
void sfCircleShape_GetPoint(const sfCircleShape* shape, unsigned int index, float* x, float* y)
sfVector2f sfCircleShape_GetPoint(const sfCircleShape* shape, unsigned int index)
{
CSFML_CHECK(shape);
sfVector2f point = {0, 0};
CSFML_CHECK_RETURN(shape, point);
sf::Vector2f point = shape->This.GetPoint(index);
if (x)
*x = point.x;
if (y)
*y = point.y;
sf::Vector2f sfmlPoint = shape->This.GetPoint(index);
point.x = sfmlPoint.x;
point.y = sfmlPoint.y;
return point;
}
+41 -40
View File
@@ -55,9 +55,9 @@ void sfConvexShape_Destroy(sfConvexShape* shape)
////////////////////////////////////////////////////////////
void sfConvexShape_SetPosition(sfConvexShape* shape, float x, float y)
void sfConvexShape_SetPosition(sfConvexShape* shape, sfVector2f position)
{
CSFML_CALL(shape, SetPosition(x, y));
CSFML_CALL(shape, SetPosition(position.x, position.y));
}
@@ -69,30 +69,30 @@ void sfConvexShape_SetRotation(sfConvexShape* shape, float angle)
////////////////////////////////////////////////////////////
void sfConvexShape_SetScale(sfConvexShape* shape, float factorX, float factorY)
void sfConvexShape_SetScale(sfConvexShape* shape, sfVector2f scale)
{
CSFML_CALL(shape, SetScale(factorX, factorY));
CSFML_CALL(shape, SetScale(scale.x, scale.y));
}
////////////////////////////////////////////////////////////
void sfConvexShape_SetOrigin(sfConvexShape* shape, float x, float y)
void sfConvexShape_SetOrigin(sfConvexShape* shape, sfVector2f origin)
{
CSFML_CALL(shape, SetOrigin(x, y));
CSFML_CALL(shape, SetOrigin(origin.x, origin.y));
}
////////////////////////////////////////////////////////////
void sfConvexShape_GetPosition(const sfConvexShape* shape, float* x, float* y)
sfVector2f sfConvexShape_GetPosition(const sfConvexShape* shape)
{
CSFML_CHECK(shape);
sfVector2f position = {0, 0};
CSFML_CHECK_RETURN(shape, position);
sf::Vector2f point = shape->This.GetPosition();
sf::Vector2f sfmlPos = shape->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return position;
}
@@ -104,37 +104,37 @@ float sfConvexShape_GetRotation(const sfConvexShape* shape)
////////////////////////////////////////////////////////////
void sfConvexShape_GetScale(const sfConvexShape* shape, float* x, float* y)
sfVector2f sfConvexShape_GetScale(const sfConvexShape* shape)
{
CSFML_CHECK(shape);
sfVector2f scale = {0, 0};
CSFML_CHECK_RETURN(shape, scale);
sf::Vector2f point = shape->This.GetScale();
sf::Vector2f sfmlScale = shape->This.GetScale();
scale.x = sfmlScale.x;
scale.y = sfmlScale.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return scale;
}
////////////////////////////////////////////////////////////
void sfConvexShape_GetOrigin(const sfConvexShape* shape, float* x, float* y)
sfVector2f sfConvexShape_GetOrigin(const sfConvexShape* shape)
{
CSFML_CHECK(shape);
sfVector2f origin = {0, 0};
CSFML_CHECK_RETURN(shape, origin);
sf::Vector2f point = shape->This.GetOrigin();
sf::Vector2f sfmlOrigin = shape->This.GetOrigin();
origin.x = sfmlOrigin.x;
origin.y = sfmlOrigin.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return origin;
}
////////////////////////////////////////////////////////////
void sfConvexShape_Move(sfConvexShape* shape, float offsetX, float offsetY)
void sfConvexShape_Move(sfConvexShape* shape, sfVector2f offset)
{
CSFML_CALL(shape, Move(offsetX, offsetY));
CSFML_CALL(shape, Move(offset.x, offset.y));
}
@@ -146,9 +146,9 @@ void sfConvexShape_Rotate(sfConvexShape* shape, float angle)
////////////////////////////////////////////////////////////
void sfConvexShape_Scale(sfConvexShape* shape, float factorX, float factorY)
void sfConvexShape_Scale(sfConvexShape* shape, sfVector2f factors)
{
CSFML_CALL(shape, Scale(factorX, factorY));
CSFML_CALL(shape, Scale(factors.x, factors.y));
}
@@ -280,15 +280,16 @@ unsigned int sfConvexShape_GetPointCount(const sfConvexShape* shape)
////////////////////////////////////////////////////////////
void sfConvexShape_GetPoint(const sfConvexShape* shape, unsigned int index, float* x, float* y)
sfVector2f sfConvexShape_GetPoint(const sfConvexShape* shape, unsigned int index)
{
CSFML_CHECK(shape);
sfVector2f point = {0, 0};
CSFML_CHECK_RETURN(shape, point);
sf::Vector2f point = shape->This.GetPoint(index);
if (x)
*x = point.x;
if (y)
*y = point.y;
sf::Vector2f sfmlPoint = shape->This.GetPoint(index);
point.x = sfmlPoint.x;
point.y = sfmlPoint.y;
return point;
}
@@ -300,9 +301,9 @@ void sfConvexShape_SetPointCount(sfConvexShape* shape, unsigned int count)
////////////////////////////////////////////////////////////
void sfConvexShape_SetPoint(sfConvexShape* shape, unsigned int index, float x, float y)
void sfConvexShape_SetPoint(sfConvexShape* shape, unsigned int index, sfVector2f point)
{
CSFML_CALL(shape, SetPoint(index, sf::Vector2f(x, y)));
CSFML_CALL(shape, SetPoint(index, sf::Vector2f(point.x, point.y)));
}
+49 -47
View File
@@ -55,9 +55,9 @@ void sfRectangleShape_Destroy(sfRectangleShape* shape)
////////////////////////////////////////////////////////////
void sfRectangleShape_SetPosition(sfRectangleShape* shape, float x, float y)
void sfRectangleShape_SetPosition(sfRectangleShape* shape, sfVector2f position)
{
CSFML_CALL(shape, SetPosition(x, y));
CSFML_CALL(shape, SetPosition(position.x, position.y));
}
@@ -69,30 +69,30 @@ void sfRectangleShape_SetRotation(sfRectangleShape* shape, float angle)
////////////////////////////////////////////////////////////
void sfRectangleShape_SetScale(sfRectangleShape* shape, float factorX, float factorY)
void sfRectangleShape_SetScale(sfRectangleShape* shape, sfVector2f scale)
{
CSFML_CALL(shape, SetScale(factorX, factorY));
CSFML_CALL(shape, SetScale(scale.x, scale.y));
}
////////////////////////////////////////////////////////////
void sfRectangleShape_SetOrigin(sfRectangleShape* shape, float x, float y)
void sfRectangleShape_SetOrigin(sfRectangleShape* shape, sfVector2f origin)
{
CSFML_CALL(shape, SetOrigin(x, y));
CSFML_CALL(shape, SetOrigin(origin.x, origin.y));
}
////////////////////////////////////////////////////////////
void sfRectangleShape_GetPosition(const sfRectangleShape* shape, float* x, float* y)
sfVector2f sfRectangleShape_GetPosition(const sfRectangleShape* shape)
{
CSFML_CHECK(shape);
sfVector2f position = {0, 0};
CSFML_CHECK_RETURN(shape, position);
sf::Vector2f point = shape->This.GetPosition();
sf::Vector2f sfmlPos = shape->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return position;
}
@@ -104,37 +104,37 @@ float sfRectangleShape_GetRotation(const sfRectangleShape* shape)
////////////////////////////////////////////////////////////
void sfRectangleShape_GetScale(const sfRectangleShape* shape, float* x, float* y)
sfVector2f sfRectangleShape_GetScale(const sfRectangleShape* shape)
{
CSFML_CHECK(shape);
sfVector2f scale = {0, 0};
CSFML_CHECK_RETURN(shape, scale);
sf::Vector2f point = shape->This.GetScale();
sf::Vector2f sfmlScale = shape->This.GetScale();
scale.x = sfmlScale.x;
scale.y = sfmlScale.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return scale;
}
////////////////////////////////////////////////////////////
void sfRectangleShape_GetOrigin(const sfRectangleShape* shape, float* x, float* y)
sfVector2f sfRectangleShape_GetOrigin(const sfRectangleShape* shape)
{
CSFML_CHECK(shape);
sfVector2f origin = {0, 0};
CSFML_CHECK_RETURN(shape, origin);
sf::Vector2f point = shape->This.GetOrigin();
sf::Vector2f sfmlOrigin = shape->This.GetOrigin();
origin.x = sfmlOrigin.x;
origin.y = sfmlOrigin.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return origin;
}
////////////////////////////////////////////////////////////
void sfRectangleShape_Move(sfRectangleShape* shape, float offsetX, float offsetY)
void sfRectangleShape_Move(sfRectangleShape* shape, sfVector2f offset)
{
CSFML_CALL(shape, Move(offsetX, offsetY));
CSFML_CALL(shape, Move(offset.x, offset.y));
}
@@ -146,9 +146,9 @@ void sfRectangleShape_Rotate(sfRectangleShape* shape, float angle)
////////////////////////////////////////////////////////////
void sfRectangleShape_Scale(sfRectangleShape* shape, float factorX, float factorY)
void sfRectangleShape_Scale(sfRectangleShape* shape, sfVector2f factors)
{
CSFML_CALL(shape, Scale(factorX, factorY));
CSFML_CALL(shape, Scale(factors.x, factors.y));
}
@@ -280,35 +280,37 @@ unsigned int sfRectangleShape_GetPointCount(const sfRectangleShape* shape)
////////////////////////////////////////////////////////////
void sfRectangleShape_GetPoint(const sfRectangleShape* shape, unsigned int index, float* x, float* y)
sfVector2f sfRectangleShape_GetPoint(const sfRectangleShape* shape, unsigned int index)
{
CSFML_CHECK(shape);
sfVector2f point = {0, 0};
CSFML_CHECK_RETURN(shape, point);
sf::Vector2f point = shape->This.GetPoint(index);
if (x)
*x = point.x;
if (y)
*y = point.y;
sf::Vector2f sfmlPoint = shape->This.GetPoint(index);
point.x = sfmlPoint.x;
point.y = sfmlPoint.y;
return point;
}
////////////////////////////////////////////////////////////
void sfRectangleShape_SetSize(sfRectangleShape* shape, float width, float height)
void sfRectangleShape_SetSize(sfRectangleShape* shape, sfVector2f size)
{
CSFML_CALL(shape, SetSize(sf::Vector2f(width, height)));
CSFML_CALL(shape, SetSize(sf::Vector2f(size.x, size.y)));
}
////////////////////////////////////////////////////////////
void sfRectangleShape_GetSize(const sfRectangleShape* shape, float* width, float* height)
sfVector2f sfRectangleShape_GetSize(const sfRectangleShape* shape)
{
CSFML_CHECK(shape);
sfVector2f size = {0, 0};
CSFML_CHECK_RETURN(shape, size);
sf::Vector2f size = shape->This.GetSize();
if (width)
*width = size.x;
if (height)
*height = size.y;
sf::Vector2f sfmlSize = shape->This.GetSize();
size.x = sfmlSize.x;
size.y = sfmlSize.y;
return size;
}
+39 -38
View File
@@ -48,9 +48,9 @@ void sfShape_Destroy(sfShape* shape)
////////////////////////////////////////////////////////////
void sfShape_SetPosition(sfShape* shape, float x, float y)
void sfShape_SetPosition(sfShape* shape, sfVector2f position)
{
CSFML_CALL(shape, SetPosition(x, y));
CSFML_CALL(shape, SetPosition(position.x, position.y));
}
@@ -62,30 +62,30 @@ void sfShape_SetRotation(sfShape* shape, float angle)
////////////////////////////////////////////////////////////
void sfShape_SetScale(sfShape* shape, float factorX, float factorY)
void sfShape_SetScale(sfShape* shape, sfVector2f scale)
{
CSFML_CALL(shape, SetScale(factorX, factorY));
CSFML_CALL(shape, SetScale(scale.x, scale.y));
}
////////////////////////////////////////////////////////////
void sfShape_SetOrigin(sfShape* shape, float x, float y)
void sfShape_SetOrigin(sfShape* shape, sfVector2f origin)
{
CSFML_CALL(shape, SetOrigin(x, y));
CSFML_CALL(shape, SetOrigin(origin.x, origin.y));
}
////////////////////////////////////////////////////////////
void sfShape_GetPosition(const sfShape* shape, float* x, float* y)
sfVector2f sfShape_GetPosition(const sfShape* shape)
{
CSFML_CHECK(shape);
sfVector2f position = {0, 0};
CSFML_CHECK_RETURN(shape, position);
sf::Vector2f point = shape->This.GetPosition();
sf::Vector2f sfmlPos = shape->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return position;
}
@@ -97,37 +97,37 @@ float sfShape_GetRotation(const sfShape* shape)
////////////////////////////////////////////////////////////
void sfShape_GetScale(const sfShape* shape, float* x, float* y)
sfVector2f sfShape_GetScale(const sfShape* shape)
{
CSFML_CHECK(shape);
sfVector2f scale = {0, 0};
CSFML_CHECK_RETURN(shape, scale);
sf::Vector2f point = shape->This.GetScale();
sf::Vector2f sfmlScale = shape->This.GetScale();
scale.x = sfmlScale.x;
scale.y = sfmlScale.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return scale;
}
////////////////////////////////////////////////////////////
void sfShape_GetOrigin(const sfShape* shape, float* x, float* y)
sfVector2f sfShape_GetOrigin(const sfShape* shape)
{
CSFML_CHECK(shape);
sfVector2f origin = {0, 0};
CSFML_CHECK_RETURN(shape, origin);
sf::Vector2f point = shape->This.GetOrigin();
sf::Vector2f sfmlOrigin = shape->This.GetOrigin();
origin.x = sfmlOrigin.x;
origin.y = sfmlOrigin.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return origin;
}
////////////////////////////////////////////////////////////
void sfShape_Move(sfShape* shape, float offsetX, float offsetY)
void sfShape_Move(sfShape* shape, sfVector2f offset)
{
CSFML_CALL(shape, Move(offsetX, offsetY));
CSFML_CALL(shape, Move(offset.x, offset.y));
}
@@ -139,9 +139,9 @@ void sfShape_Rotate(sfShape* shape, float angle)
////////////////////////////////////////////////////////////
void sfShape_Scale(sfShape* shape, float factorX, float factorY)
void sfShape_Scale(sfShape* shape, sfVector2f factors)
{
CSFML_CALL(shape, Scale(factorX, factorY));
CSFML_CALL(shape, Scale(factors.x, factors.y));
}
@@ -273,15 +273,16 @@ unsigned int sfShape_GetPointCount(const sfShape* shape)
////////////////////////////////////////////////////////////
void sfShape_GetPoint(const sfShape* shape, unsigned int index, float* x, float* y)
sfVector2f sfShape_GetPoint(const sfShape* shape, unsigned int index)
{
CSFML_CHECK(shape);
sfVector2f point = {0, 0};
CSFML_CHECK_RETURN(shape, point);
sf::Vector2f point = shape->This.GetPoint(index);
if (x)
*x = point.x;
if (y)
*y = point.y;
sf::Vector2f sfmlPoint = shape->This.GetPoint(index);
point.x = sfmlPoint.x;
point.y = sfmlPoint.y;
return point;
}
+2 -3
View File
@@ -58,9 +58,8 @@ public :
virtual sf::Vector2f GetPoint(unsigned int index) const
{
sf::Vector2f point;
myGetPointCallback(index, &point.x, &point.y, myUserData);
return point;
sfVector2f point = myGetPointCallback(index, myUserData);
return sf::Vector2f(point.x, point.y);
}
using sf::Shape::Update;
+31 -31
View File
@@ -59,9 +59,9 @@ void sfSprite_Destroy(sfSprite* sprite)
////////////////////////////////////////////////////////////
void sfSprite_SetPosition(sfSprite* sprite, float x, float y)
void sfSprite_SetPosition(sfSprite* sprite, sfVector2f position)
{
CSFML_CALL(sprite, SetPosition(x, y));
CSFML_CALL(sprite, SetPosition(position.x, position.y));
}
@@ -73,30 +73,30 @@ void sfSprite_SetRotation(sfSprite* sprite, float angle)
////////////////////////////////////////////////////////////
void sfSprite_SetScale(sfSprite* sprite, float factorX, float factorY)
void sfSprite_SetScale(sfSprite* sprite, sfVector2f scale)
{
CSFML_CALL(sprite, SetScale(factorX, factorY));
CSFML_CALL(sprite, SetScale(scale.x, scale.y));
}
////////////////////////////////////////////////////////////
void sfSprite_SetOrigin(sfSprite* sprite, float x, float y)
void sfSprite_SetOrigin(sfSprite* sprite, sfVector2f origin)
{
CSFML_CALL(sprite, SetOrigin(x, y));
CSFML_CALL(sprite, SetOrigin(origin.x, origin.y));
}
////////////////////////////////////////////////////////////
void sfSprite_GetPosition(const sfSprite* sprite, float* x, float* y)
sfVector2f sfSprite_GetPosition(const sfSprite* sprite)
{
CSFML_CHECK(sprite);
sfVector2f position = {0, 0};
CSFML_CHECK_RETURN(sprite, position);
sf::Vector2f point = sprite->This.GetPosition();
sf::Vector2f sfmlPos = sprite->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return position;
}
@@ -108,37 +108,37 @@ float sfSprite_GetRotation(const sfSprite* sprite)
////////////////////////////////////////////////////////////
void sfSprite_GetScale(const sfSprite* sprite, float* x, float* y)
sfVector2f sfSprite_GetScale(const sfSprite* sprite)
{
CSFML_CHECK(sprite);
sfVector2f scale = {0, 0};
CSFML_CHECK_RETURN(sprite, scale);
sf::Vector2f point = sprite->This.GetScale();
sf::Vector2f sfmlScale = sprite->This.GetScale();
scale.x = sfmlScale.x;
scale.y = sfmlScale.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return scale;
}
////////////////////////////////////////////////////////////
void sfSprite_GetOrigin(const sfSprite* sprite, float* x, float* y)
sfVector2f sfSprite_GetOrigin(const sfSprite* sprite)
{
CSFML_CHECK(sprite);
sfVector2f origin = {0, 0};
CSFML_CHECK_RETURN(sprite, origin);
sf::Vector2f point = sprite->This.GetOrigin();
sf::Vector2f sfmlOrigin = sprite->This.GetOrigin();
origin.x = sfmlOrigin.x;
origin.y = sfmlOrigin.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return origin;
}
////////////////////////////////////////////////////////////
void sfSprite_Move(sfSprite* sprite, float offsetX, float offsetY)
void sfSprite_Move(sfSprite* sprite, sfVector2f offset)
{
CSFML_CALL(sprite, Move(offsetX, offsetY));
CSFML_CALL(sprite, Move(offset.x, offset.y));
}
@@ -150,9 +150,9 @@ void sfSprite_Rotate(sfSprite* sprite, float angle)
////////////////////////////////////////////////////////////
void sfSprite_Scale(sfSprite* sprite, float factorX, float factorY)
void sfSprite_Scale(sfSprite* sprite, sfVector2f factors)
{
CSFML_CALL(sprite, Scale(factorX, factorY));
CSFML_CALL(sprite, Scale(factors.x, factors.y));
}
+39 -38
View File
@@ -59,9 +59,9 @@ void sfText_Destroy(sfText* text)
////////////////////////////////////////////////////////////
void sfText_SetPosition(sfText* text, float x, float y)
void sfText_SetPosition(sfText* text, sfVector2f position)
{
CSFML_CALL(text, SetPosition(x, y));
CSFML_CALL(text, SetPosition(position.x, position.y));
}
@@ -73,30 +73,30 @@ void sfText_SetRotation(sfText* text, float angle)
////////////////////////////////////////////////////////////
void sfText_SetScale(sfText* text, float factorX, float factorY)
void sfText_SetScale(sfText* text, sfVector2f scale)
{
CSFML_CALL(text, SetScale(factorX, factorY));
CSFML_CALL(text, SetScale(scale.x, scale.y));
}
////////////////////////////////////////////////////////////
void sfText_SetOrigin(sfText* text, float x, float y)
void sfText_SetOrigin(sfText* text, sfVector2f origin)
{
CSFML_CALL(text, SetOrigin(x, y));
CSFML_CALL(text, SetOrigin(origin.x, origin.y));
}
////////////////////////////////////////////////////////////
void sfText_GetPosition(const sfText* text, float* x, float* y)
sfVector2f sfText_GetPosition(const sfText* text)
{
CSFML_CHECK(text);
sfVector2f position = {0, 0};
CSFML_CHECK_RETURN(text, position);
sf::Vector2f point = text->This.GetPosition();
sf::Vector2f sfmlPos = text->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return position;
}
@@ -108,37 +108,37 @@ float sfText_GetRotation(const sfText* text)
////////////////////////////////////////////////////////////
void sfText_GetScale(const sfText* text, float* x, float* y)
sfVector2f sfText_GetScale(const sfText* text)
{
CSFML_CHECK(text);
sfVector2f scale = {0, 0};
CSFML_CHECK_RETURN(text, scale);
sf::Vector2f point = text->This.GetScale();
sf::Vector2f sfmlScale = text->This.GetScale();
scale.x = sfmlScale.x;
scale.y = sfmlScale.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return scale;
}
////////////////////////////////////////////////////////////
void sfText_GetOrigin(const sfText* text, float* x, float* y)
sfVector2f sfText_GetOrigin(const sfText* text)
{
CSFML_CHECK(text);
sfVector2f origin = {0, 0};
CSFML_CHECK_RETURN(text, origin);
sf::Vector2f point = text->This.GetOrigin();
sf::Vector2f sfmlOrigin = text->This.GetOrigin();
origin.x = sfmlOrigin.x;
origin.y = sfmlOrigin.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return origin;
}
////////////////////////////////////////////////////////////
void sfText_Move(sfText* text, float offsetX, float offsetY)
void sfText_Move(sfText* text, sfVector2f offset)
{
CSFML_CALL(text, Move(offsetX, offsetY));
CSFML_CALL(text, Move(offset.x, offset.y));
}
@@ -150,9 +150,9 @@ void sfText_Rotate(sfText* text, float angle)
////////////////////////////////////////////////////////////
void sfText_Scale(sfText* text, float factorX, float factorY)
void sfText_Scale(sfText* text, sfVector2f factors)
{
CSFML_CALL(text, Scale(factorX, factorY));
CSFML_CALL(text, Scale(factors.x, factors.y));
}
@@ -282,15 +282,16 @@ sfColor sfText_GetColor(const sfText* text)
////////////////////////////////////////////////////////////
void sfText_FindCharacterPos(const sfText* text, size_t index, float* x, float* y)
sfVector2f sfText_FindCharacterPos(const sfText* text, size_t index)
{
CSFML_CHECK(text);
sfVector2f position = {0, 0};
CSFML_CHECK_RETURN(text, position);
sf::Vector2f pos = text->This.FindCharacterPos(index);
if (x)
*x = pos.x;
if (y)
*y = pos.y;
sf::Vector2f sfmlPos = text->This.FindCharacterPos(index);
position.x = sfmlPos.x;
position.y = sfmlPos.y;
return position;
}
+31 -31
View File
@@ -56,9 +56,9 @@ void sfTransformable_Destroy(sfTransformable* transformable)
////////////////////////////////////////////////////////////
void sfTransformable_SetPosition(sfTransformable* transformable, float x, float y)
void sfTransformable_SetPosition(sfTransformable* transformable, sfVector2f position)
{
CSFML_CALL(transformable, SetPosition(x, y));
CSFML_CALL(transformable, SetPosition(position.x, position.y));
}
@@ -70,30 +70,30 @@ void sfTransformable_SetRotation(sfTransformable* transformable, float angle)
////////////////////////////////////////////////////////////
void sfTransformable_SetScale(sfTransformable* transformable, float factorX, float factorY)
void sfTransformable_SetScale(sfTransformable* transformable, sfVector2f scale)
{
CSFML_CALL(transformable, SetScale(factorX, factorY));
CSFML_CALL(transformable, SetScale(scale.x, scale.y));
}
////////////////////////////////////////////////////////////
void sfTransformable_SetOrigin(sfTransformable* transformable, float x, float y)
void sfTransformable_SetOrigin(sfTransformable* transformable, sfVector2f origin)
{
CSFML_CALL(transformable, SetOrigin(x, y));
CSFML_CALL(transformable, SetOrigin(origin.x, origin.y));
}
////////////////////////////////////////////////////////////
void sfTransformable_GetPosition(const sfTransformable* transformable, float* x, float* y)
sfVector2f sfTransformable_GetPosition(const sfTransformable* transformable)
{
CSFML_CHECK(transformable);
sfVector2f position = {0, 0};
CSFML_CHECK_RETURN(transformable, position);
sf::Vector2f point = transformable->This.GetPosition();
sf::Vector2f sfmlPos = transformable->This.GetPosition();
position.x = sfmlPos.x;
position.y = sfmlPos.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return position;
}
@@ -105,37 +105,37 @@ float sfTransformable_GetRotation(const sfTransformable* transformable)
////////////////////////////////////////////////////////////
void sfTransformable_GetScale(const sfTransformable* transformable, float* x, float* y)
sfVector2f sfTransformable_GetScale(const sfTransformable* transformable)
{
CSFML_CHECK(transformable);
sfVector2f scale = {0, 0};
CSFML_CHECK_RETURN(transformable, scale);
sf::Vector2f point = transformable->This.GetScale();
sf::Vector2f sfmlScale = transformable->This.GetScale();
scale.x = sfmlScale.x;
scale.y = sfmlScale.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return scale;
}
////////////////////////////////////////////////////////////
void sfTransformable_GetOrigin(const sfTransformable* transformable, float* x, float* y)
sfVector2f sfTransformable_GetOrigin(const sfTransformable* transformable)
{
CSFML_CHECK(transformable);
sfVector2f origin = {0, 0};
CSFML_CHECK_RETURN(transformable, origin);
sf::Vector2f point = transformable->This.GetOrigin();
sf::Vector2f sfmlOrigin = transformable->This.GetOrigin();
origin.x = sfmlOrigin.x;
origin.y = sfmlOrigin.y;
if (x)
*x = point.x;
if (y)
*y = point.y;
return origin;
}
////////////////////////////////////////////////////////////
void sfTransformable_Move(sfTransformable* transformable, float offsetX, float offsetY)
void sfTransformable_Move(sfTransformable* transformable, sfVector2f offset)
{
CSFML_CALL(transformable, Move(offsetX, offsetY));
CSFML_CALL(transformable, Move(offset.x, offset.y));
}
@@ -147,9 +147,9 @@ void sfTransformable_Rotate(sfTransformable* transformable, float angle)
////////////////////////////////////////////////////////////
void sfTransformable_Scale(sfTransformable* transformable, float factorX, float factorY)
void sfTransformable_Scale(sfTransformable* transformable, sfVector2f factors)
{
CSFML_CALL(transformable, Scale(factorX, factorY));
CSFML_CALL(transformable, Scale(factors.x, factors.y));
}
+22 -20
View File
@@ -64,16 +64,16 @@ void sfView_Destroy(sfView* view)
////////////////////////////////////////////////////////////
void sfView_SetCenter(sfView* view, float x, float y)
void sfView_SetCenter(sfView* view, sfVector2f center)
{
CSFML_CALL(view, SetCenter(x, y));
CSFML_CALL(view, SetCenter(center.x, center.y));
}
////////////////////////////////////////////////////////////
void sfView_SetSize(sfView* view, float width, float height)
void sfView_SetSize(sfView* view, sfVector2f size)
{
CSFML_CALL(view, SetSize(width, height));
CSFML_CALL(view, SetSize(size.x, size.y));
}
@@ -99,28 +99,30 @@ void sfView_Reset(sfView* view, sfFloatRect rectangle)
////////////////////////////////////////////////////////////
void sfView_GetCenter(const sfView* view, float* x, float* y)
sfVector2f sfView_GetCenter(const sfView* view)
{
CSFML_CHECK(view);
sfVector2f center = {0, 0};
CSFML_CHECK_RETURN(view, center);
sf::Vector2f center = view->This.GetCenter();
if (x)
*x = center.x;
if (y)
*y = center.y;
sf::Vector2f sfmlCenter = view->This.GetCenter();
center.x = sfmlCenter.x;
center.y = sfmlCenter.y;
return center;
}
////////////////////////////////////////////////////////////
void sfView_GetSize(const sfView* view, float* width, float* height)
sfVector2f sfView_GetSize(const sfView* view)
{
CSFML_CHECK(view);
sfVector2f size = {0, 0};
CSFML_CHECK_RETURN(view, size);
sf::Vector2f size = view->This.GetSize();
if (width)
*width = size.x;
if (height)
*height = size.y;
sf::Vector2f sfmlSize = view->This.GetSize();
size.x = sfmlSize.x;
size.y = sfmlSize.y;
return size;
}
@@ -148,9 +150,9 @@ sfFloatRect sfView_GetViewport(const sfView* view)
////////////////////////////////////////////////////////////
void sfView_Move(sfView* view, float offsetX, float offsetY)
void sfView_Move(sfView* view, sfVector2f offset)
{
CSFML_CALL(view, Move(offsetX, offsetY));
CSFML_CALL(view, Move(offset.x, offset.y));
}
+9 -11
View File
@@ -39,26 +39,24 @@ sfBool sfMouse_IsButtonPressed(sfMouseButton button)
////////////////////////////////////////////////////////////
void sfMouse_GetPosition(int* x, int* y, const sfWindow* relativeTo)
sfVector2i sfMouse_GetPosition(const sfWindow* relativeTo)
{
sf::Vector2i position;
sf::Vector2i sfmlPos;
if (relativeTo)
position = sf::Mouse::GetPosition(relativeTo->This);
sfmlPos = sf::Mouse::GetPosition(relativeTo->This);
else
position = sf::Mouse::GetPosition();
sfmlPos = sf::Mouse::GetPosition();
if (x)
*x = position.x;
if (y)
*y = position.y;
sfVector2i position = {sfmlPos.x, sfmlPos.y};
return position;
}
////////////////////////////////////////////////////////////
void sfMouse_SetPosition(int x, int y, const sfWindow* relativeTo)
void sfMouse_SetPosition(sfVector2i position, const sfWindow* relativeTo)
{
if (relativeTo)
sf::Mouse::SetPosition(sf::Vector2i(x, y), relativeTo->This);
sf::Mouse::SetPosition(sf::Vector2i(position.x, position.y), relativeTo->This);
else
sf::Mouse::SetPosition(sf::Vector2i(x, y));
sf::Mouse::SetPosition(sf::Vector2i(position.x, position.y));
}