mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-25 21:06:12 +01:00
Now using Vector2 and Vector3 structs in functions
This commit is contained in:
1 parent
69433eb0a4
commit
9d0d0588b2
28 files changed
+566
-608
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user