mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 13:06:13 +01:00
Updated to the new Mouse functions
This commit is contained in:
1 parent
45d3b05d65
commit
56df80a7d3
6 files changed
+38
-71
No files matched your search
@@ -217,15 +217,6 @@ void sfRenderWindow_ShowMouseCursor(sfRenderWindow* renderWindow, sfBool show)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the mouse cursor on a window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfRenderWindow_SetCursorPosition(sfRenderWindow* renderWindow, unsigned int left, unsigned int top)
|
||||
{
|
||||
CSFML_CALL(renderWindow, SetCursorPosition(left, top));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of a window on screen.
|
||||
/// Only works for top-level windows
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window/Mouse.h>
|
||||
#include <SFML/Window/WindowStruct.h>
|
||||
#include <SFML/Window/Mouse.hpp>
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
@@ -42,12 +43,28 @@ sfBool sfMouse_IsButtonPressed(sfMouseButton button)
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current position of the mouse
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMouse_GetPosition(int* x, int* y)
|
||||
void sfMouse_GetPosition(int* x, int* y, const sfWindow* relativeTo)
|
||||
{
|
||||
sf::Vector2i position = sf::Mouse::GetPosition();
|
||||
sf::Vector2i position;
|
||||
if (relativeTo)
|
||||
position = sf::Mouse::GetPosition(relativeTo->This);
|
||||
else
|
||||
position = sf::Mouse::GetPosition();
|
||||
|
||||
if (x)
|
||||
*x = position.x;
|
||||
if (y)
|
||||
*y = position.y;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current position of the mouse
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMouse_SetPosition(int x, int y, const sfWindow* relativeTo)
|
||||
{
|
||||
if (relativeTo)
|
||||
sf::Mouse::SetPosition(sf::Vector2i(x, y), relativeTo->This);
|
||||
else
|
||||
sf::Mouse::SetPosition(sf::Vector2i(x, y));
|
||||
}
|
||||
@@ -209,30 +209,6 @@ void sfWindow_ShowMouseCursor(sfWindow* window, sfBool show)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the mouse cursor on a window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_SetCursorPosition(sfWindow* window, unsigned int left, unsigned int top)
|
||||
{
|
||||
CSFML_CALL(window, SetCursorPosition(left, top))
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of the mouse cursor on a window
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfWindow_GetCursorPosition(sfWindow* window, int* left, int* top)
|
||||
{
|
||||
CSFML_CHECK(window);
|
||||
sf::Vector2i position = window->This.GetCursorPosition();
|
||||
|
||||
if (left)
|
||||
*left = position.x;
|
||||
if (top)
|
||||
*top = position.y;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of a window on screen.
|
||||
/// Only works for top-level windows
|
||||
|
||||
Reference in new issue
Block a user