Updated RenderTarget::convertCoords

This commit is contained in:
Laurent Gomila committed 2012-03-27 17:26:18 +02:00
1 parent bdaa4974ac
commit 228a06ba64
4 files changed
+28 -24

No files matched your search

+4 -5
View File
@@ -140,14 +140,13 @@ CSFML_GRAPHICS_API sfIntRect sfRenderTexture_getViewport(const sfRenderTexture*
/// \brief Convert a point in texture coordinates into view coordinates
///
/// \param renderTexture Render texture object
/// \param windowX X coordinate of the point to convert, relative to the texture
/// \param windowY Y coordinate of the point to convert, relative to the texture
/// \param viewX Pointer to fill with the X coordinate of the converted point
/// \param viewY Pointer to fill with the Y coordinate of the converted point
/// \param point Point to convert, relative to the texture
/// \param targetView Target view to convert the point to (pass NULL to use the current view)
///
/// \return The converted point, in "world" units
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderTexture_convertCoords(const sfRenderTexture* renderTexture, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView);
CSFML_GRAPHICS_API sfVector2f sfRenderTexture_convertCoords(const sfRenderTexture* renderTexture, sfVector2i point, const sfView* targetView);
////////////////////////////////////////////////////////////
/// \brief Draw a drawable object to the render-target
+4 -5
View File
@@ -316,14 +316,13 @@ CSFML_GRAPHICS_API sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* re
/// \brief Convert a point in window coordinates into view coordinates
///
/// \param renderWindow Render window object
/// \param windowX X coordinate of the point to convert, relative to the window
/// \param windowY Y coordinate of the point to convert, relative to the window
/// \param viewX Pointer to fill with the X coordinate of the converted point
/// \param viewY Pointer to fill with the Y coordinate of the converted point
/// \param point Point to convert, relative to the window
/// \param targetView Target view to convert the point to (pass NULL to use the current view)
///
/// \return The converted point, in "world" units
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_convertCoords(const sfRenderWindow* renderWindow, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView);
CSFML_GRAPHICS_API sfVector2f sfRenderWindow_convertCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* targetView);
////////////////////////////////////////////////////////////
/// \brief Draw a drawable object to the render-target
+10 -7
View File
@@ -141,18 +141,21 @@ sfIntRect sfRenderTexture_getViewport(const sfRenderTexture* renderTexture, cons
////////////////////////////////////////////////////////////
void sfRenderTexture_convertCoords(const sfRenderTexture* renderTexture, unsigned int textureX, unsigned int textureY, float* viewX, float* viewY, const sfView* targetView)
sfVector2f sfRenderTexture_convertCoords(const sfRenderTexture* renderTexture, sfVector2i point, const sfView* targetView)
{
CSFML_CHECK(renderTexture);
sfVector2f result = {0, 0};
CSFML_CHECK_RETURN(renderWindow, result);
sf::Vector2f point;
sf::Vector2f sfmlPoint;
if (targetView)
point = renderTexture->This.convertCoords(textureX, textureY, targetView->This);
sfmlPoint = renderTexture->This.convertCoords(sf::Vector2i(point.x, point.y), targetView->This);
else
point = renderTexture->This.convertCoords(textureX, textureY);
sfmlPoint = renderTexture->This.convertCoords(sf::Vector2i(point.x, point.y));
if (viewX) *viewX = point.x;
if (viewY) *viewY = point.y;
result.x = sfmlPoint.x;
result.y = sfmlPoint.y;
return result;
}
+10 -7
View File
@@ -346,18 +346,21 @@ sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const s
////////////////////////////////////////////////////////////
void sfRenderWindow_convertCoords(const sfRenderWindow* renderWindow, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView)
sfVector2f sfRenderWindow_convertCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* targetView)
{
CSFML_CHECK(renderWindow);
sfVector2f result = {0, 0};
CSFML_CHECK_RETURN(renderWindow, result);
sf::Vector2f point;
sf::Vector2f sfmlPoint;
if (targetView)
point = renderWindow->This.convertCoords(windowX, windowY, targetView->This);
sfmlPoint = renderWindow->This.convertCoords(sf::Vector2i(point.x, point.y), targetView->This);
else
point = renderWindow->This.convertCoords(windowX, windowY);
sfmlPoint = renderWindow->This.convertCoords(sf::Vector2i(point.x, point.y));
if (viewX) *viewX = point.x;
if (viewY) *viewY = point.y;
result.x = sfmlPoint.x;
result.y = sfmlPoint.y;
return result;
}