mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
FS#88 - Replace Set/GetCenter with Set/GetOrigin in sf::Drawable
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1121 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
5461ddcb52
commit
42c5800d4c
@ -57,7 +57,7 @@ EXPORTS
|
||||
sfShape_SetScaleY
|
||||
sfShape_SetScale
|
||||
sfShape_SetRotation
|
||||
sfShape_SetCenter
|
||||
sfShape_SetOrigin
|
||||
sfShape_SetColor
|
||||
sfShape_SetBlendMode
|
||||
sfShape_GetX
|
||||
@ -65,8 +65,8 @@ EXPORTS
|
||||
sfShape_GetScaleX
|
||||
sfShape_GetScaleY
|
||||
sfShape_GetRotation
|
||||
sfShape_GetCenterX
|
||||
sfShape_GetCenterY
|
||||
sfShape_GetOriginX
|
||||
sfShape_GetOriginY
|
||||
sfShape_GetColor
|
||||
sfShape_GetBlendMode
|
||||
sfShape_Move
|
||||
@ -95,7 +95,7 @@ EXPORTS
|
||||
sfSprite_SetScaleY
|
||||
sfSprite_SetScale
|
||||
sfSprite_SetRotation
|
||||
sfSprite_SetCenter
|
||||
sfSprite_SetOrigin
|
||||
sfSprite_SetColor
|
||||
sfSprite_SetBlendMode
|
||||
sfSprite_GetX
|
||||
@ -103,8 +103,8 @@ EXPORTS
|
||||
sfSprite_GetScaleX
|
||||
sfSprite_GetScaleY
|
||||
sfSprite_GetRotation
|
||||
sfSprite_GetCenterX
|
||||
sfSprite_GetCenterY
|
||||
sfSprite_GetOriginX
|
||||
sfSprite_GetOriginY
|
||||
sfSprite_GetColor
|
||||
sfSprite_GetBlendMode
|
||||
sfSprite_Move
|
||||
@ -137,7 +137,7 @@ EXPORTS
|
||||
sfString_SetScaleY
|
||||
sfString_SetScale
|
||||
sfString_SetRotation
|
||||
sfString_SetCenter
|
||||
sfString_SetOrigin
|
||||
sfString_SetColor
|
||||
sfString_SetBlendMode
|
||||
sfString_GetX
|
||||
@ -145,8 +145,8 @@ EXPORTS
|
||||
sfString_GetScaleX
|
||||
sfString_GetScaleY
|
||||
sfString_GetRotation
|
||||
sfString_GetCenterX
|
||||
sfString_GetCenterY
|
||||
sfString_GetOriginX
|
||||
sfString_GetOriginY
|
||||
sfString_GetColor
|
||||
sfString_GetBlendMode
|
||||
sfString_Move
|
||||
|
@ -57,7 +57,7 @@ EXPORTS
|
||||
sfShape_SetScaleY
|
||||
sfShape_SetScale
|
||||
sfShape_SetRotation
|
||||
sfShape_SetCenter
|
||||
sfShape_SetOrigin
|
||||
sfShape_SetColor
|
||||
sfShape_SetBlendMode
|
||||
sfShape_GetX
|
||||
@ -65,8 +65,8 @@ EXPORTS
|
||||
sfShape_GetScaleX
|
||||
sfShape_GetScaleY
|
||||
sfShape_GetRotation
|
||||
sfShape_GetCenterX
|
||||
sfShape_GetCenterY
|
||||
sfShape_GetOriginX
|
||||
sfShape_GetOriginY
|
||||
sfShape_GetColor
|
||||
sfShape_GetBlendMode
|
||||
sfShape_Move
|
||||
@ -95,7 +95,7 @@ EXPORTS
|
||||
sfSprite_SetScaleY
|
||||
sfSprite_SetScale
|
||||
sfSprite_SetRotation
|
||||
sfSprite_SetCenter
|
||||
sfSprite_SetOrigin
|
||||
sfSprite_SetColor
|
||||
sfSprite_SetBlendMode
|
||||
sfSprite_GetX
|
||||
@ -103,8 +103,8 @@ EXPORTS
|
||||
sfSprite_GetScaleX
|
||||
sfSprite_GetScaleY
|
||||
sfSprite_GetRotation
|
||||
sfSprite_GetCenterX
|
||||
sfSprite_GetCenterY
|
||||
sfSprite_GetOriginX
|
||||
sfSprite_GetOriginY
|
||||
sfSprite_GetColor
|
||||
sfSprite_GetBlendMode
|
||||
sfSprite_Move
|
||||
@ -137,7 +137,7 @@ EXPORTS
|
||||
sfString_SetScaleY
|
||||
sfString_SetScale
|
||||
sfString_SetRotation
|
||||
sfString_SetCenter
|
||||
sfString_SetOrigin
|
||||
sfString_SetColor
|
||||
sfString_SetBlendMode
|
||||
sfString_GetX
|
||||
@ -145,8 +145,8 @@ EXPORTS
|
||||
sfString_GetScaleX
|
||||
sfString_GetScaleY
|
||||
sfString_GetRotation
|
||||
sfString_GetCenterX
|
||||
sfString_GetCenterY
|
||||
sfString_GetOriginX
|
||||
sfString_GetOriginY
|
||||
sfString_GetColor
|
||||
sfString_GetBlendMode
|
||||
sfString_Move
|
||||
|
@ -57,7 +57,7 @@ EXPORTS
|
||||
sfShape_SetScaleY
|
||||
sfShape_SetScale
|
||||
sfShape_SetRotation
|
||||
sfShape_SetCenter
|
||||
sfShape_SetOrigin
|
||||
sfShape_SetColor
|
||||
sfShape_SetBlendMode
|
||||
sfShape_GetX
|
||||
@ -65,8 +65,8 @@ EXPORTS
|
||||
sfShape_GetScaleX
|
||||
sfShape_GetScaleY
|
||||
sfShape_GetRotation
|
||||
sfShape_GetCenterX
|
||||
sfShape_GetCenterY
|
||||
sfShape_GetOriginX
|
||||
sfShape_GetOriginY
|
||||
sfShape_GetColor
|
||||
sfShape_GetBlendMode
|
||||
sfShape_Move
|
||||
@ -95,7 +95,7 @@ EXPORTS
|
||||
sfSprite_SetScaleY
|
||||
sfSprite_SetScale
|
||||
sfSprite_SetRotation
|
||||
sfSprite_SetCenter
|
||||
sfSprite_SetOrigin
|
||||
sfSprite_SetColor
|
||||
sfSprite_SetBlendMode
|
||||
sfSprite_GetX
|
||||
@ -103,8 +103,8 @@ EXPORTS
|
||||
sfSprite_GetScaleX
|
||||
sfSprite_GetScaleY
|
||||
sfSprite_GetRotation
|
||||
sfSprite_GetCenterX
|
||||
sfSprite_GetCenterY
|
||||
sfSprite_GetOriginX
|
||||
sfSprite_GetOriginY
|
||||
sfSprite_GetColor
|
||||
sfSprite_GetBlendMode
|
||||
sfSprite_Move
|
||||
@ -137,7 +137,7 @@ EXPORTS
|
||||
sfString_SetScaleY
|
||||
sfString_SetScale
|
||||
sfString_SetRotation
|
||||
sfString_SetCenter
|
||||
sfString_SetOrigin
|
||||
sfString_SetColor
|
||||
sfString_SetBlendMode
|
||||
sfString_GetX
|
||||
@ -145,8 +145,8 @@ EXPORTS
|
||||
sfString_GetScaleX
|
||||
sfString_GetScaleY
|
||||
sfString_GetRotation
|
||||
sfString_GetCenterX
|
||||
sfString_GetCenterY
|
||||
sfString_GetOriginX
|
||||
sfString_GetOriginY
|
||||
sfString_GetColor
|
||||
sfString_GetBlendMode
|
||||
sfString_Move
|
||||
|
@ -57,7 +57,7 @@ EXPORTS
|
||||
sfShape_SetScaleY
|
||||
sfShape_SetScale
|
||||
sfShape_SetRotation
|
||||
sfShape_SetCenter
|
||||
sfShape_SetOrigin
|
||||
sfShape_SetColor
|
||||
sfShape_SetBlendMode
|
||||
sfShape_GetX
|
||||
@ -65,8 +65,8 @@ EXPORTS
|
||||
sfShape_GetScaleX
|
||||
sfShape_GetScaleY
|
||||
sfShape_GetRotation
|
||||
sfShape_GetCenterX
|
||||
sfShape_GetCenterY
|
||||
sfShape_GetOriginX
|
||||
sfShape_GetOriginY
|
||||
sfShape_GetColor
|
||||
sfShape_GetBlendMode
|
||||
sfShape_Move
|
||||
@ -95,7 +95,7 @@ EXPORTS
|
||||
sfSprite_SetScaleY
|
||||
sfSprite_SetScale
|
||||
sfSprite_SetRotation
|
||||
sfSprite_SetCenter
|
||||
sfSprite_SetOrigin
|
||||
sfSprite_SetColor
|
||||
sfSprite_SetBlendMode
|
||||
sfSprite_GetX
|
||||
@ -103,8 +103,8 @@ EXPORTS
|
||||
sfSprite_GetScaleX
|
||||
sfSprite_GetScaleY
|
||||
sfSprite_GetRotation
|
||||
sfSprite_GetCenterX
|
||||
sfSprite_GetCenterY
|
||||
sfSprite_GetOriginX
|
||||
sfSprite_GetOriginY
|
||||
sfSprite_GetColor
|
||||
sfSprite_GetBlendMode
|
||||
sfSprite_Move
|
||||
@ -137,7 +137,7 @@ EXPORTS
|
||||
sfString_SetScaleY
|
||||
sfString_SetScale
|
||||
sfString_SetRotation
|
||||
sfString_SetCenter
|
||||
sfString_SetOrigin
|
||||
sfString_SetColor
|
||||
sfString_SetBlendMode
|
||||
sfString_GetX
|
||||
@ -145,8 +145,8 @@ EXPORTS
|
||||
sfString_GetScaleX
|
||||
sfString_GetScaleY
|
||||
sfString_GetRotation
|
||||
sfString_GetCenterX
|
||||
sfString_GetCenterY
|
||||
sfString_GetOriginX
|
||||
sfString_GetOriginY
|
||||
sfString_GetColor
|
||||
sfString_GetBlendMode
|
||||
sfString_Move
|
||||
|
@ -153,15 +153,15 @@ CSFML_API void sfShape_SetScale(sfShape* Shape, float ScaleX, float ScaleY);
|
||||
CSFML_API void sfShape_SetRotation(sfShape* Shape, float Rotation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of a shape, in coordinates relative to
|
||||
/// Set the local origin of a shape, in coordinates relative to
|
||||
/// its left-top corner
|
||||
///
|
||||
/// \param Shape : Shape to modify
|
||||
/// \param X : X coordinate of the center
|
||||
/// \param Y : Y coordinate of the center
|
||||
/// \param X : X coordinate of the origin
|
||||
/// \param Y : Y coordinate of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetCenter(sfShape* Shape, float X, float Y);
|
||||
CSFML_API void sfShape_SetOrigin(sfShape* Shape, float X, float Y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a shape
|
||||
@ -232,24 +232,24 @@ CSFML_API float sfShape_GetScaleY(sfShape* Shape);
|
||||
CSFML_API float sfShape_GetRotation(sfShape* Shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the center a shape
|
||||
/// Get the X position of the origin a shape
|
||||
///
|
||||
/// \param Shape : Shape to read
|
||||
///
|
||||
/// \return Current X center
|
||||
/// \return Current X origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetCenterX(sfShape* Shape);
|
||||
CSFML_API float sfShape_GetOriginX(sfShape* Shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of the center a shape
|
||||
/// Get the Y position of the origin a shape
|
||||
///
|
||||
/// \param Shape : Shape to read
|
||||
///
|
||||
/// \return Current Y center
|
||||
/// \return Current Y origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetCenterY(sfShape* Shape);
|
||||
CSFML_API float sfShape_GetOriginY(sfShape* Shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a shape
|
||||
@ -302,7 +302,7 @@ CSFML_API void sfShape_Rotate(sfShape* Shape, float Angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the shape's local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param Shape : Shape object
|
||||
/// \param PointX : X coordinate of the point to transform
|
||||
@ -315,7 +315,7 @@ CSFML_API void sfShape_TransformToLocal(sfShape* Shape, float PointX, float Poin
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the shape's local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param Shape : Shape object
|
||||
/// \param PointX : X coordinate of the point to transform
|
||||
|
@ -117,15 +117,15 @@ CSFML_API void sfSprite_SetScale(sfSprite* Sprite, float ScaleX, float ScaleY);
|
||||
CSFML_API void sfSprite_SetRotation(sfSprite* Sprite, float Rotation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of a sprite, in coordinates relative to
|
||||
/// Set the local origin of a sprite, in coordinates relative to
|
||||
/// its left-top corner
|
||||
///
|
||||
/// \param Sprite : Sprite to modify
|
||||
/// \param X : X coordinate of the center
|
||||
/// \param Y : Y coordinate of the center
|
||||
/// \param X : X coordinate of the origin
|
||||
/// \param Y : Y coordinate of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetCenter(sfSprite* Sprite, float X, float Y);
|
||||
CSFML_API void sfSprite_SetOrigin(sfSprite* Sprite, float X, float Y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a sprite
|
||||
@ -196,24 +196,24 @@ CSFML_API float sfSprite_GetScaleY(sfSprite* Sprite);
|
||||
CSFML_API float sfSprite_GetRotation(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the center a sprite
|
||||
/// Get the X position of the origin a sprite
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Current X center
|
||||
/// \return Current X origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetCenterX(sfSprite* Sprite);
|
||||
CSFML_API float sfSprite_GetOriginX(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of the center a sprite
|
||||
/// Get the Y position of the origin a sprite
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Current Y center
|
||||
/// \return Current Y origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetCenterY(sfSprite* Sprite);
|
||||
CSFML_API float sfSprite_GetOriginY(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a sprite
|
||||
@ -266,7 +266,7 @@ CSFML_API void sfSprite_Rotate(sfSprite* Sprite, float Angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the sprite's local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param Sprite : Sprite object
|
||||
/// \param PointX : X coordinate of the point to transform
|
||||
@ -279,7 +279,7 @@ CSFML_API void sfSprite_TransformToLocal(sfSprite* Sprite, float PointX, float P
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the sprite's local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param Sprite : Sprite object
|
||||
/// \param PointX : X coordinate of the point to transform
|
||||
|
@ -129,15 +129,15 @@ CSFML_API void sfString_SetScale(sfString* String, float ScaleX, float ScaleY);
|
||||
CSFML_API void sfString_SetRotation(sfString* String, float Rotation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of a string, in coordinates
|
||||
/// Set the local origin of a string, in coordinates
|
||||
/// relative to its left-top corner
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param X : X coordinate of the center
|
||||
/// \param Y : Y coordinate of the center
|
||||
/// \param X : X coordinate of the origin
|
||||
/// \param Y : Y coordinate of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetCenter(sfString* String, float X, float Y);
|
||||
CSFML_API void sfString_SetOrigin(sfString* String, float X, float Y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a string
|
||||
@ -208,24 +208,24 @@ CSFML_API float sfString_GetScaleY(sfString* String);
|
||||
CSFML_API float sfString_GetRotation(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the center a string
|
||||
/// Get the X position of the origin a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current X center position
|
||||
/// \return Current X origin position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetCenterX(sfString* String);
|
||||
CSFML_API float sfString_GetOriginX(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the top Y of the center of a string
|
||||
/// Get the top Y of the origin of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current Y center position
|
||||
/// \return Current Y origin position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetCenterY(sfString* String);
|
||||
CSFML_API float sfString_GetOriginY(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a string
|
||||
@ -278,7 +278,7 @@ CSFML_API void sfString_Rotate(sfString* String, float Angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the string's local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param String : String object
|
||||
/// \param PointX : X coordinate of the point to transform
|
||||
@ -291,7 +291,7 @@ CSFML_API void sfString_TransformToLocal(sfString* String, float PointX, float P
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the string's local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param String : String object
|
||||
/// \param PointX : X coordinate of the point to transform
|
||||
@ -400,7 +400,7 @@ CSFML_API unsigned long sfString_GetStyle(sfString* String);
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the visual position of the Index-th character of the string,
|
||||
/// in coordinates relative to the string
|
||||
/// (note : translation, center, rotation and scale are not applied)
|
||||
/// (note : translation, origin, rotation and scale are not applied)
|
||||
///
|
||||
/// \param String : String to read
|
||||
/// \param Index : Index of the character
|
||||
|
@ -161,12 +161,12 @@ void sfShape_SetRotation(sfShape* Shape, float Rotation)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of a shape, in coordinates
|
||||
/// Set the local origin of a shape, in coordinates
|
||||
/// relative to its left-top corner
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfShape_SetCenter(sfShape* Shape, float X, float Y)
|
||||
void sfShape_SetOrigin(sfShape* Shape, float X, float Y)
|
||||
{
|
||||
CSFML_CALL(Shape, SetCenter(sf::Vector2f(X, Y)))
|
||||
CSFML_CALL(Shape, SetOrigin(sf::Vector2f(X, Y)))
|
||||
}
|
||||
|
||||
|
||||
@ -234,20 +234,20 @@ float sfShape_GetRotation(sfShape* Shape)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the center a shape
|
||||
/// Get the X position of the origin a shape
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfShape_GetCenterX(sfShape* Shape)
|
||||
float sfShape_GetOriginX(sfShape* Shape)
|
||||
{
|
||||
CSFML_CALL_RETURN(Shape, GetCenter().x, 0.f)
|
||||
CSFML_CALL_RETURN(Shape, GetOrigin().x, 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of the center a shape
|
||||
/// Get the Y position of the origin a shape
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfShape_GetCenterY(sfShape* Shape)
|
||||
float sfShape_GetOriginY(sfShape* Shape)
|
||||
{
|
||||
CSFML_CALL_RETURN(Shape, GetCenter().y, 0.f)
|
||||
CSFML_CALL_RETURN(Shape, GetOrigin().y, 0.f)
|
||||
}
|
||||
|
||||
|
||||
@ -304,7 +304,7 @@ void sfShape_Rotate(sfShape* Shape, float Angle)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the shape's local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfShape_TransformToLocal(sfShape* Shape, float PointX, float PointY, float* X, float* Y)
|
||||
{
|
||||
@ -318,7 +318,7 @@ void sfShape_TransformToLocal(sfShape* Shape, float PointX, float PointY, float*
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the shape's local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfShape_TransformToGlobal(sfShape* Shape, float PointX, float PointY, float* X, float* Y)
|
||||
{
|
||||
|
@ -134,12 +134,12 @@ void sfSprite_SetRotation(sfSprite* Sprite, float Rotation)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of a sprite, in coordinates
|
||||
/// Set the local origin of a sprite, in coordinates
|
||||
/// relative to its left-top corner
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSprite_SetCenter(sfSprite* Sprite, float X, float Y)
|
||||
void sfSprite_SetOrigin(sfSprite* Sprite, float X, float Y)
|
||||
{
|
||||
CSFML_CALL(Sprite, SetCenter(sf::Vector2f(X, Y)))
|
||||
CSFML_CALL(Sprite, SetOrigin(sf::Vector2f(X, Y)))
|
||||
}
|
||||
|
||||
|
||||
@ -207,20 +207,20 @@ float sfSprite_GetRotation(sfSprite* Sprite)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the center a sprite
|
||||
/// Get the X position of the origin a sprite
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSprite_GetCenterX(sfSprite* Sprite)
|
||||
float sfSprite_GetOriginX(sfSprite* Sprite)
|
||||
{
|
||||
CSFML_CALL_RETURN(Sprite, GetCenter().x, 0.f)
|
||||
CSFML_CALL_RETURN(Sprite, GetOrigin().x, 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of the center a sprite
|
||||
/// Get the Y position of the origin a sprite
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfSprite_GetCenterY(sfSprite* Sprite)
|
||||
float sfSprite_GetOriginY(sfSprite* Sprite)
|
||||
{
|
||||
CSFML_CALL_RETURN(Sprite, GetCenter().y, 0.f)
|
||||
CSFML_CALL_RETURN(Sprite, GetOrigin().y, 0.f)
|
||||
}
|
||||
|
||||
|
||||
@ -277,7 +277,7 @@ void sfSprite_Rotate(sfSprite* Sprite, float Angle)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the sprite's local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSprite_TransformToLocal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y)
|
||||
{
|
||||
@ -291,7 +291,7 @@ void sfSprite_TransformToLocal(sfSprite* Sprite, float PointX, float PointY, flo
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the sprite's local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfSprite_TransformToGlobal(sfSprite* Sprite, float PointX, float PointY, float* X, float* Y)
|
||||
{
|
||||
|
@ -133,12 +133,12 @@ void sfString_SetRotation(sfString* String, float Rotation)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of a string, in coordinates
|
||||
/// Set the local origin of a string, in coordinates
|
||||
/// relative to its left-top corner
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_SetCenter(sfString* String, float X, float Y)
|
||||
void sfString_SetOrigin(sfString* String, float X, float Y)
|
||||
{
|
||||
CSFML_CALL(String, SetCenter(sf::Vector2f(X, Y)))
|
||||
CSFML_CALL(String, SetOrigin(sf::Vector2f(X, Y)))
|
||||
}
|
||||
|
||||
|
||||
@ -206,20 +206,20 @@ float sfString_GetRotation(sfString* String)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the center a string
|
||||
/// Get the X position of the origin a string
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetCenterX(sfString* String)
|
||||
float sfString_GetOriginX(sfString* String)
|
||||
{
|
||||
CSFML_CALL_RETURN(String, GetCenter().x, 0.f)
|
||||
CSFML_CALL_RETURN(String, GetOrigin().x, 0.f)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the top Y of the center of a string
|
||||
/// Get the top Y of the origin of a string
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfString_GetCenterY(sfString* String)
|
||||
float sfString_GetOriginY(sfString* String)
|
||||
{
|
||||
CSFML_CALL_RETURN(String, GetCenter().y, 0.f)
|
||||
CSFML_CALL_RETURN(String, GetOrigin().y, 0.f)
|
||||
}
|
||||
|
||||
|
||||
@ -276,7 +276,7 @@ void sfString_Rotate(sfString* String, float Angle)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the string's local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_TransformToLocal(sfString* String, float PointX, float PointY, float* X, float* Y)
|
||||
{
|
||||
@ -290,7 +290,7 @@ void sfString_TransformToLocal(sfString* String, float PointX, float PointY, flo
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the string's local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_TransformToGlobal(sfString* String, float PointX, float PointY, float* X, float* Y)
|
||||
{
|
||||
@ -407,7 +407,7 @@ unsigned long sfString_GetStyle(sfString* String)
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the visual position of the Index-th character of the string,
|
||||
/// in coordinates relative to the string
|
||||
/// (note : translation, center, rotation and scale are not applied)
|
||||
/// (note : translation, origin, rotation and scale are not applied)
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfString_GetCharacterPos(sfString* String, size_t Index, float* X, float* Y)
|
||||
{
|
||||
|
@ -56,11 +56,11 @@ namespace SFML
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Center of the transformation of the object
|
||||
/// Origin of the transformation of the object
|
||||
/// (center of translation, rotation and scale)
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public abstract Vector2 Center {get; set;}
|
||||
public abstract Vector2 Origin {get; set;}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
@ -79,7 +79,7 @@ namespace SFML
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Transform a point from global coordinates into local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
/// </summary>
|
||||
/// <param name="point">Point to transform</param>
|
||||
/// <returns>Transformed point</returns>
|
||||
@ -89,7 +89,7 @@ namespace SFML
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Transform a point from local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
/// </summary>
|
||||
/// <param name="point">Point to transform</param>
|
||||
/// <returns>Transformed point</returns>
|
||||
|
@ -60,14 +60,14 @@ namespace SFML
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Center of the transformation of the object
|
||||
/// Origin of the transformation of the object
|
||||
/// (center of translation, rotation and scale)
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override Vector2 Center
|
||||
public override Vector2 Origin
|
||||
{
|
||||
get { return new Vector2(sfShape_GetCenterX(This), sfShape_GetCenterY(This)); }
|
||||
set { sfShape_SetCenter(This, value.X, value.Y); }
|
||||
get { return new Vector2(sfShape_GetOriginX(This), sfShape_GetOriginY(This)); }
|
||||
set { sfShape_SetOrigin(This, value.X, value.Y); }
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -95,7 +95,7 @@ namespace SFML
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Transform a point from global coordinates into local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
/// </summary>
|
||||
/// <param name="point">Point to transform</param>
|
||||
/// <returns>Transformed point</returns>
|
||||
@ -111,7 +111,7 @@ namespace SFML
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Transform a point from local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
/// </summary>
|
||||
/// <param name="point">Point to transform</param>
|
||||
/// <returns>Transformed point</returns>
|
||||
@ -426,13 +426,13 @@ namespace SFML
|
||||
static extern float sfShape_GetScaleY(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfShape_SetCenter(IntPtr This, float X, float Y);
|
||||
static extern void sfShape_SetOrigin(IntPtr This, float X, float Y);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern float sfShape_GetCenterX(IntPtr This);
|
||||
static extern float sfShape_GetOriginX(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern float sfShape_GetCenterY(IntPtr This);
|
||||
static extern float sfShape_GetOriginY(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfShape_SetColor(IntPtr This, Color Color);
|
||||
|
@ -71,14 +71,14 @@ namespace SFML
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Center of the transformation of the object
|
||||
/// Origin of the transformation of the object
|
||||
/// (center of translation, rotation and scale)
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override Vector2 Center
|
||||
public override Vector2 Origin
|
||||
{
|
||||
get { return new Vector2(sfSprite_GetCenterX(This), sfSprite_GetCenterY(This)); }
|
||||
set { sfSprite_SetCenter(This, value.X, value.Y); }
|
||||
get { return new Vector2(sfSprite_GetOriginX(This), sfSprite_GetOriginY(This)); }
|
||||
set { sfSprite_SetOrigin(This, value.X, value.Y); }
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -106,7 +106,7 @@ namespace SFML
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Transform a point from global coordinates into local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
/// </summary>
|
||||
/// <param name="point">Point to transform</param>
|
||||
/// <returns>Transformed point</returns>
|
||||
@ -122,7 +122,7 @@ namespace SFML
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Transform a point from local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
/// </summary>
|
||||
/// <param name="point">Point to transform</param>
|
||||
/// <returns>Transformed point</returns>
|
||||
@ -271,13 +271,13 @@ namespace SFML
|
||||
static extern float sfSprite_GetScaleY(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfSprite_SetCenter(IntPtr This, float X, float Y);
|
||||
static extern void sfSprite_SetOrigin(IntPtr This, float X, float Y);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern float sfSprite_GetCenterX(IntPtr This);
|
||||
static extern float sfSprite_GetOriginX(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern float sfSprite_GetCenterY(IntPtr This);
|
||||
static extern float sfSprite_GetOriginY(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfSprite_SetColor(IntPtr This, Color Color);
|
||||
|
@ -118,14 +118,14 @@ namespace SFML
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Center of the transformation of the object
|
||||
/// Origin of the transformation of the object
|
||||
/// (center of translation, rotation and scale)
|
||||
/// </summary>
|
||||
////////////////////////////////////////////////////////////
|
||||
public override Vector2 Center
|
||||
public override Vector2 Origin
|
||||
{
|
||||
get { return new Vector2(sfString_GetCenterX(This), sfString_GetCenterY(This)); }
|
||||
set { sfString_SetCenter(This, value.X, value.Y); }
|
||||
get { return new Vector2(sfString_GetOriginX(This), sfString_GetOriginY(This)); }
|
||||
set { sfString_SetOrigin(This, value.X, value.Y); }
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -153,7 +153,7 @@ namespace SFML
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Transform a point from global coordinates into local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
/// </summary>
|
||||
/// <param name="point">Point to transform</param>
|
||||
/// <returns>Transformed point</returns>
|
||||
@ -169,7 +169,7 @@ namespace SFML
|
||||
////////////////////////////////////////////////////////////
|
||||
/// <summary>
|
||||
/// Transform a point from local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
/// </summary>
|
||||
/// <param name="point">Point to transform</param>
|
||||
/// <returns>Transformed point</returns>
|
||||
@ -243,7 +243,7 @@ namespace SFML
|
||||
/// <summary>
|
||||
/// Return the visual position of the Index-th character of the string,
|
||||
/// in coordinates relative to the string
|
||||
/// (note : translation, center, rotation and scale are not applied)
|
||||
/// (note : translation, origin, rotation and scale are not applied)
|
||||
/// </summary>
|
||||
/// <param name="index">Index of the character</param>
|
||||
/// <returns>Position of the Index-th character (end of string if Index is out of range)</returns>
|
||||
@ -312,13 +312,13 @@ namespace SFML
|
||||
static extern float sfString_GetScaleY(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfString_SetCenter(IntPtr This, float X, float Y);
|
||||
static extern void sfString_SetOrigin(IntPtr This, float X, float Y);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern float sfString_GetCenterX(IntPtr This);
|
||||
static extern float sfString_GetOriginX(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern float sfString_GetCenterY(IntPtr This);
|
||||
static extern float sfString_GetOriginY(IntPtr This);
|
||||
|
||||
[DllImport("csfml-graphics"), SuppressUnmanagedCodeSecurity]
|
||||
static extern void sfString_SetColor(IntPtr This, Color Color);
|
||||
|
@ -143,25 +143,25 @@ public :
|
||||
void SetScaleY(float FactorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of the object, in coordinates relative to the
|
||||
/// Set the local origin of the object, in coordinates relative to the
|
||||
/// top-left of the object (take 2 values).
|
||||
/// The default center is (0, 0)
|
||||
/// The default origin is (0, 0)
|
||||
///
|
||||
/// \param CenterX : X coordinate of the center
|
||||
/// \param CenterY : Y coordinate of the center
|
||||
/// \param OriginX : X coordinate of the origin
|
||||
/// \param OriginY : Y coordinate of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetCenter(float CenterX, float CenterY);
|
||||
void SetOrigin(float OriginX, float OriginY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of the object, in coordinates relative to the
|
||||
/// Set the local origin of the object, in coordinates relative to the
|
||||
/// top-left of the object (take a 2D vector).
|
||||
/// The default center is (0, 0)
|
||||
/// The default origin is (0, 0)
|
||||
///
|
||||
/// \param Center : New center
|
||||
/// \param Origin : New origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetCenter(const Vector2f& Center);
|
||||
void SetOrigin(const Vector2f& Origin);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the orientation of the object
|
||||
@ -206,12 +206,12 @@ public :
|
||||
const Vector2f& GetScale() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the center of the object
|
||||
/// Get the local origin of the object
|
||||
///
|
||||
/// \return Current position of the center
|
||||
/// \return Current position of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vector2f& GetCenter() const;
|
||||
const Vector2f& GetOrigin() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the orientation of the object.
|
||||
@ -282,7 +282,7 @@ public :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param Point : Point to transform
|
||||
///
|
||||
@ -293,7 +293,7 @@ public :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param Point : Point to transform
|
||||
///
|
||||
@ -345,7 +345,7 @@ private :
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2f myPosition; ///< Position of the object on screen
|
||||
Vector2f myScale; ///< Scale of the object
|
||||
Vector2f myCenter; ///< Origin of translation / rotation / scaling of the object
|
||||
Vector2f myOrigin; ///< Origin of translation / rotation / scaling of the object
|
||||
float myRotation; ///< Orientation of the object, in degrees
|
||||
Color myColor; ///< Overlay color of the object
|
||||
Blend::Mode myBlendMode; ///< Blending mode
|
||||
|
@ -39,7 +39,7 @@ private :
|
||||
|
||||
// Setup the sprite
|
||||
mySprite.SetImage(myImage);
|
||||
mySprite.SetCenter(mySprite.GetSize() / 2.f);
|
||||
mySprite.SetOrigin(mySprite.GetSize() / 2.f);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -81,7 +81,7 @@ INT WINAPI WinMain(HINSTANCE Instance, HINSTANCE, LPSTR, INT)
|
||||
return EXIT_FAILURE;
|
||||
sf::Sprite Sprite1(Image1);
|
||||
sf::Sprite Sprite2(Image2);
|
||||
Sprite1.SetCenter(Sprite1.GetSize() / 2.f);
|
||||
Sprite1.SetOrigin(Sprite1.GetSize() / 2.f);
|
||||
|
||||
// Create a clock for measuring elapsed time
|
||||
sf::Clock Clock;
|
||||
|
@ -23,7 +23,7 @@ public :
|
||||
// Load an image and assign it to our sprite
|
||||
myImage.LoadFromFile("datas/wxwidgets/sfml.png");
|
||||
mySprite.SetImage(myImage);
|
||||
mySprite.SetCenter(mySprite.GetSize() / 2.f);
|
||||
mySprite.SetOrigin(mySprite.GetSize() / 2.f);
|
||||
|
||||
// Catch the mouse move event
|
||||
Connect(wxEVT_MOTION, wxMouseEventHandler(MyCanvas::OnMouseMove));
|
||||
|
@ -39,7 +39,7 @@ namespace sf
|
||||
Drawable::Drawable(const Vector2f& Position, const Vector2f& Scale, float Rotation, const Color& Col) :
|
||||
myPosition (Position),
|
||||
myScale (Scale),
|
||||
myCenter (0, 0),
|
||||
myOrigin (0, 0),
|
||||
myRotation (Rotation),
|
||||
myColor (Col),
|
||||
myBlendMode (Blend::Alpha),
|
||||
@ -150,27 +150,27 @@ void Drawable::SetScaleY(float FactorY)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of the object, in coordinates relative to the
|
||||
/// Set the local origin of the object, in coordinates relative to the
|
||||
/// top-left of the object (take 2 values).
|
||||
/// The default center is (0, 0)
|
||||
/// The default origin is (0, 0)
|
||||
////////////////////////////////////////////////////////////
|
||||
void Drawable::SetCenter(float CenterX, float CenterY)
|
||||
void Drawable::SetOrigin(float OriginX, float OriginY)
|
||||
{
|
||||
myCenter.x = CenterX;
|
||||
myCenter.y = CenterY;
|
||||
myOrigin.x = OriginX;
|
||||
myOrigin.y = OriginY;
|
||||
myNeedUpdate = true;
|
||||
myInvNeedUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of the object, in coordinates relative to the
|
||||
/// Set the local origin of the object, in coordinates relative to the
|
||||
/// top-left of the object (take a 2D vector).
|
||||
/// The default center is (0, 0)
|
||||
/// The default origin is (0, 0)
|
||||
////////////////////////////////////////////////////////////
|
||||
void Drawable::SetCenter(const Vector2f& Center)
|
||||
void Drawable::SetOrigin(const Vector2f& Origin)
|
||||
{
|
||||
SetCenter(Center.x, Center.y);
|
||||
SetOrigin(Origin.x, Origin.y);
|
||||
}
|
||||
|
||||
|
||||
@ -226,11 +226,11 @@ const Vector2f& Drawable::GetScale() const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the center of the object
|
||||
/// Get the origin of the object
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vector2f& Drawable::GetCenter() const
|
||||
const Vector2f& Drawable::GetOrigin() const
|
||||
{
|
||||
return myCenter;
|
||||
return myOrigin;
|
||||
}
|
||||
|
||||
|
||||
@ -311,7 +311,7 @@ void Drawable::Rotate(float Angle)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
sf::Vector2f Drawable::TransformToLocal(const sf::Vector2f& Point) const
|
||||
{
|
||||
@ -320,7 +320,7 @@ sf::Vector2f Drawable::TransformToLocal(const sf::Vector2f& Point) const
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from local coordinates into global coordinates
|
||||
/// (ie it applies the object's center, translation, rotation and scale to the point)
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
////////////////////////////////////////////////////////////
|
||||
sf::Vector2f Drawable::TransformToGlobal(const sf::Vector2f& Point) const
|
||||
{
|
||||
@ -336,7 +336,7 @@ const Matrix3& Drawable::GetMatrix() const
|
||||
// First recompute it if needed
|
||||
if (myNeedUpdate)
|
||||
{
|
||||
myMatrix.SetFromTransformations(myCenter, myPosition, myRotation, myScale);
|
||||
myMatrix.SetFromTransformations(myOrigin, myPosition, myRotation, myScale);
|
||||
myNeedUpdate = false;
|
||||
}
|
||||
|
||||
|
@ -198,10 +198,10 @@ FloatRect String::GetRect() const
|
||||
const_cast<String*>(this)->RecomputeRect();
|
||||
|
||||
FloatRect Rect;
|
||||
Rect.Left = (myBaseRect.Left - GetCenter().x) * GetScale().x + GetPosition().x;
|
||||
Rect.Top = (myBaseRect.Top - GetCenter().y) * GetScale().y + GetPosition().y;
|
||||
Rect.Right = (myBaseRect.Right - GetCenter().x) * GetScale().x + GetPosition().x;
|
||||
Rect.Bottom = (myBaseRect.Bottom - GetCenter().y) * GetScale().y + GetPosition().y;
|
||||
Rect.Left = (myBaseRect.Left - GetOrigin().x) * GetScale().x + GetPosition().x;
|
||||
Rect.Top = (myBaseRect.Top - GetOrigin().y) * GetScale().y + GetPosition().y;
|
||||
Rect.Right = (myBaseRect.Right - GetOrigin().x) * GetScale().x + GetPosition().x;
|
||||
Rect.Bottom = (myBaseRect.Bottom - GetOrigin().y) * GetScale().y + GetPosition().y;
|
||||
|
||||
return Rect;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user