Renamed convertCoords to mapPixelToCoords, and added its inverse mapCoordsToPixel

This commit is contained in:
Laurent Gomila committed 2012-11-10 10:49:49 +01:00
1 parent 00bd5c9a22
commit 3277479584
4 files changed
+137 -14

No files matched your search

+22 -3
View File
@@ -141,16 +141,35 @@ sfIntRect sfRenderTexture_getViewport(const sfRenderTexture* renderTexture, cons
////////////////////////////////////////////////////////////
sfVector2f sfRenderTexture_convertCoords(const sfRenderTexture* renderTexture, sfVector2i point, const sfView* targetView)
sfVector2f sfRenderTexture_mapPixelToCoords(const sfRenderTexture* renderTexture, sfVector2i point, const sfView* targetView)
{
sfVector2f result = {0, 0};
CSFML_CHECK_RETURN(renderTexture, result);
sf::Vector2f sfmlPoint;
if (targetView)
sfmlPoint = renderTexture->This.convertCoords(sf::Vector2i(point.x, point.y), targetView->This);
sfmlPoint = renderTexture->This.mapPixelToCoords(sf::Vector2i(point.x, point.y), targetView->This);
else
sfmlPoint = renderTexture->This.convertCoords(sf::Vector2i(point.x, point.y));
sfmlPoint = renderTexture->This.mapPixelToCoords(sf::Vector2i(point.x, point.y));
result.x = sfmlPoint.x;
result.y = sfmlPoint.y;
return result;
}
////////////////////////////////////////////////////////////
sfVector2i sfRenderTexture_mapCoordsToPixel(const sfRenderTexture* renderTexture, sfVector2f point, const sfView* targetView)
{
sfVector2i result = {0, 0};
CSFML_CHECK_RETURN(renderTexture, result);
sf::Vector2i sfmlPoint;
if (targetView)
sfmlPoint = renderTexture->This.mapCoordsToPixel(sf::Vector2f(point.x, point.y), targetView->This);
else
sfmlPoint = renderTexture->This.mapCoordsToPixel(sf::Vector2f(point.x, point.y));
result.x = sfmlPoint.x;
result.y = sfmlPoint.y;
+22 -3
View File
@@ -346,16 +346,35 @@ sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const s
////////////////////////////////////////////////////////////
sfVector2f sfRenderWindow_convertCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* targetView)
sfVector2f sfRenderWindow_mapPixelToCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* targetView)
{
sfVector2f result = {0, 0};
CSFML_CHECK_RETURN(renderWindow, result);
sf::Vector2f sfmlPoint;
if (targetView)
sfmlPoint = renderWindow->This.convertCoords(sf::Vector2i(point.x, point.y), targetView->This);
sfmlPoint = renderWindow->This.mapPixelToCoords(sf::Vector2i(point.x, point.y), targetView->This);
else
sfmlPoint = renderWindow->This.convertCoords(sf::Vector2i(point.x, point.y));
sfmlPoint = renderWindow->This.mapPixelToCoords(sf::Vector2i(point.x, point.y));
result.x = sfmlPoint.x;
result.y = sfmlPoint.y;
return result;
}
////////////////////////////////////////////////////////////
sfVector2i sfRenderWindow_mapCoordsToPixel(const sfRenderWindow* renderWindow, sfVector2f point, const sfView* targetView)
{
sfVector2i result = {0, 0};
CSFML_CHECK_RETURN(renderWindow, result);
sf::Vector2i sfmlPoint;
if (targetView)
sfmlPoint = renderWindow->This.mapCoordsToPixel(sf::Vector2f(point.x, point.y), targetView->This);
else
sfmlPoint = renderWindow->This.mapCoordsToPixel(sf::Vector2f(point.x, point.y));
result.x = sfmlPoint.x;
result.y = sfmlPoint.y;