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

+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));
}