mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 13:06:13 +01:00
Renamed convertCoords to mapPixelToCoords, and added its inverse mapCoordsToPixel
This commit is contained in:
1 parent
00bd5c9a22
commit
3277479584
4 files changed
+137
-14
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user