Merge pull request #68 from zsbzsb/update/touch_get_position_renderwindow

Added sfTouch_getPositionRenderWindow(...) function
This commit is contained in:
Laurent Gomila committed 2015-02-27 17:51:40 +01:00
commit caf9aba55e
2 files changed
+32 -3

No files matched your search

+15
View File
@@ -36,6 +36,7 @@
#include <SFML/Graphics/RectangleShapeStruct.h>
#include <SFML/Graphics/VertexArrayStruct.h>
#include <SFML/Graphics/ConvertRenderStates.hpp>
#include <SFML/Window/Touch.hpp>
#include <SFML/Internal.h>
#include <SFML/ConvertEvent.h>
@@ -533,3 +534,17 @@ void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow*
else
sf::Mouse::setPosition(sf::Vector2i(position.x, position.y));
}
////////////////////////////////////////////////////////////
sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo)
{
sf::Vector2i sfmlPosition;
if (relativeTo)
sfmlPosition = sf::Touch::getPosition(finger, relativeTo->This);
else
sfmlPosition = sf::Touch::getPosition(finger);
sfVector2i position = { sfmlPosition.x, sfmlPosition.y };
return position;
}