mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 21:53:37 +02:00
Added sfTouch_getPositionRenderWindow(...) function
This commit is contained in:
1 parent
91a09b3ce5
commit
109a02c829
2 files changed
+32
-3
No files matched your search
@@ -511,20 +511,20 @@ CSFML_GRAPHICS_API void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindo
|
||||
CSFML_GRAPHICS_API sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the mouse relatively to a render-window
|
||||
/// \brief Get the current position of the mouse relative to a render-window
|
||||
///
|
||||
/// This function returns the current position of the mouse
|
||||
/// cursor relative to the given render-window, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Position of the mouse cursor, relative to the given render-window
|
||||
/// \return Position of the mouse cursor, relative to the given render window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the current position of the mouse relatively to a render-window
|
||||
/// \brief Set the current position of the mouse relative to a render window
|
||||
///
|
||||
/// This function sets the current position of the mouse
|
||||
/// cursor relative to the given render-window, or desktop if NULL is passed.
|
||||
@@ -535,5 +535,19 @@ CSFML_GRAPHICS_API sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWind
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of a touch in window coordinates
|
||||
///
|
||||
/// This function returns the current touch position
|
||||
/// relative to the given render window, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param finger Finger index
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Current position of \a finger, or undefined if it's not down
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo);
|
||||
|
||||
|
||||
#endif // SFML_RENDERWINDOW_H
|
||||
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user