From 270f505570f4b9b0424fd98d32e3eb1a1361ede1 Mon Sep 17 00:00:00 2001 From: Laurent Gomila Date: Fri, 8 Jul 2011 07:56:14 +0200 Subject: [PATCH] Removed Window::GetCursorPosition/SetCursorPosition, added Mouse::GetPosition/SetPosition (two versions: one that handles desktop coordinates, one that handles window coordinates) --- examples/opengl/OpenGL.cpp | 4 +- examples/shader/Shader.cpp | 4 +- include/SFML/Window/Mouse.hpp | 64 ++++++++++++++++++----- include/SFML/Window/Window.hpp | 17 ------ src/SFML/Window/Linux/InputImpl.cpp | 36 ++++++++++++- src/SFML/Window/Linux/InputImpl.hpp | 44 +++++++++++++++- src/SFML/Window/Linux/WindowImplX11.cpp | 24 --------- src/SFML/Window/Linux/WindowImplX11.hpp | 17 ------ src/SFML/Window/Mouse.cpp | 33 ++++++++---- src/SFML/Window/OSX/InputImpl.cpp | 22 ++++++++ src/SFML/Window/OSX/InputImpl.hpp | 44 +++++++++++++++- src/SFML/Window/OSX/WindowImplCocoa.hpp | 17 ------ src/SFML/Window/OSX/WindowImplCocoa.mm | 15 ------ src/SFML/Window/Win32/InputImpl.cpp | 32 ++++++++++-- src/SFML/Window/Win32/InputImpl.hpp | 44 +++++++++++++++- src/SFML/Window/Win32/WindowImplWin32.cpp | 20 ------- src/SFML/Window/Win32/WindowImplWin32.hpp | 17 ------ src/SFML/Window/Window.cpp | 15 ------ src/SFML/Window/WindowImpl.hpp | 17 ------ 19 files changed, 287 insertions(+), 199 deletions(-) diff --git a/examples/opengl/OpenGL.cpp b/examples/opengl/OpenGL.cpp index 3b02e38c..0be2ea57 100644 --- a/examples/opengl/OpenGL.cpp +++ b/examples/opengl/OpenGL.cpp @@ -90,8 +90,8 @@ int main() glClear(GL_DEPTH_BUFFER_BIT); // We get the position of the mouse cursor, so that we can move the box accordingly - float x = window.GetCursorPosition().x * 200.f / window.GetWidth() - 100.f; - float y = -window.GetCursorPosition().y * 200.f / window.GetHeight() + 100.f; + float x = sf::Mouse::GetPosition(window).x * 200.f / window.GetWidth() - 100.f; + float y = -sf::Mouse::GetPosition(window).y * 200.f / window.GetHeight() + 100.f; // Apply some transformations glMatrixMode(GL_MODELVIEW); diff --git a/examples/shader/Shader.cpp b/examples/shader/Shader.cpp index b30257a1..5a75fbbb 100644 --- a/examples/shader/Shader.cpp +++ b/examples/shader/Shader.cpp @@ -202,8 +202,8 @@ int main() } // Get the mouse position in the range [0, 1] - float mouseX = window.GetCursorPosition().x / static_cast(window.GetWidth()); - float mouseY = window.GetCursorPosition().y / static_cast(window.GetHeight()); + float mouseX = sf::Mouse::GetPosition(window).x / static_cast(window.GetWidth()); + float mouseY = sf::Mouse::GetPosition(window).y / static_cast(window.GetHeight()); // Update the shaders backgroundShader.Update(mouseX, mouseY); diff --git a/include/SFML/Window/Mouse.hpp b/include/SFML/Window/Mouse.hpp index 34cc0259..f5d07966 100644 --- a/include/SFML/Window/Mouse.hpp +++ b/include/SFML/Window/Mouse.hpp @@ -34,6 +34,8 @@ namespace sf { +class Window; + //////////////////////////////////////////////////////////// /// \brief Give access to the real-time state of the mouse /// @@ -68,18 +70,51 @@ public : static bool IsButtonPressed(Button button); //////////////////////////////////////////////////////////// - /// \brief Get the current position of the mouse + /// \brief Get the current position of the mouse in desktop coordinates /// - /// This function returns the current position of the mouse - /// cursor. - /// If the cursor is over a SFML window, the returned position - /// is relative to this window. Otherwise, the returned position - /// is in desktop coordinates. + /// This function returns the global position of the mouse + /// cursor on the desktop. /// /// \return Current position of the mouse /// //////////////////////////////////////////////////////////// static Vector2i GetPosition(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the mouse in window coordinates + /// + /// This function returns the current position of the mouse + /// cursor, relative to the given window. + /// + /// \param relativeTo Reference window + /// + /// \return Current position of the mouse + /// + //////////////////////////////////////////////////////////// + static Vector2i GetPosition(const Window& relativeTo); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in desktop coordinates + /// + /// This function sets the global position of the mouse + /// cursor on the desktop. + /// + /// \param position New position of the mouse + /// + //////////////////////////////////////////////////////////// + static void SetPosition(const Vector2i& position); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the mouse in window coordinates + /// + /// This function sets the current position of the mouse + /// cursor, relative to the given window. + /// + /// \param position New position of the mouse + /// \param relativeTo Reference window + /// + //////////////////////////////////////////////////////////// + static void SetPosition(const Vector2i& position, const Window& relativeTo); }; } // namespace sf @@ -107,10 +142,11 @@ public : /// moved, pressed or released when your window is out of focus /// and no event is triggered. /// -/// Note that the sf::Mouse::GetPosition function has a special -/// behaviour: it returns the cursor position relative to the -/// window which has the mouse focus (ie. the window on which -/// the cursor is). +/// The SetPosition and GetPosition functions can be used to change +/// or retrieve the current position of the mouse pointer. There are +/// two versions: one that operates in global coordinates (relative +/// to the desktop) and one that operates in window coordinates +/// (relative to a specific window). /// /// Usage example: /// \code @@ -118,12 +154,12 @@ public : /// { /// // left click... /// } -/// else if (sf::Mouse::IsButtonPressed(sf::Mouse::Right)) -/// { -/// // right click... -/// } /// +/// // get global mouse position /// sf::Vector2i position = sf::Mouse::GetPosition(); +/// +/// // set mouse position relative to a window +/// sf::Mouse::SetPosition(sf::Vector2i(100, 200), window); /// \endcode /// /// \see sf::Joystick, sf::Keyboard diff --git a/include/SFML/Window/Window.hpp b/include/SFML/Window/Window.hpp index 1189d1a2..52e27ee3 100644 --- a/include/SFML/Window/Window.hpp +++ b/include/SFML/Window/Window.hpp @@ -278,23 +278,6 @@ public : //////////////////////////////////////////////////////////// void ShowMouseCursor(bool show); - //////////////////////////////////////////////////////////// - /// \brief Change the position of the mouse cursor - /// - /// \param x Left coordinate of the cursor, relative to the window - /// \param y Top coordinate of the cursor, relative to the window - /// - //////////////////////////////////////////////////////////// - void SetCursorPosition(unsigned int x, unsigned int y); - - //////////////////////////////////////////////////////////// - /// \brief Get the position of the mouse cursor - /// - /// \return Current mouse cursor position, relative to the window - /// - //////////////////////////////////////////////////////////// - Vector2i GetCursorPosition() const; - //////////////////////////////////////////////////////////// /// \brief Change the position of the window on screen /// diff --git a/src/SFML/Window/Linux/InputImpl.cpp b/src/SFML/Window/Linux/InputImpl.cpp index 0c1a683f..b876f033 100644 --- a/src/SFML/Window/Linux/InputImpl.cpp +++ b/src/SFML/Window/Linux/InputImpl.cpp @@ -213,16 +213,48 @@ Vector2i InputImpl::GetMousePosition() { // we don't care about these but they are required ::Window root, child; - int wx, wy; + int x, y; + unsigned int buttons; + + int gx = 0; + int gy = 0; + XQueryPointer(global.display, global.window, &root, &child, &gx, &gy, &x, &y, &buttons); + + return Vector2i(gx, gy); +} + + +//////////////////////////////////////////////////////////// +Vector2i InputImpl::GetMousePosition(const Window& relativeTo) +{ + // we don't care about these but they are required + ::Window root, child; + int gx, gy; unsigned int buttons; int x = 0; int y = 0; - XQueryPointer(global.display, global.window, &root, &child, &x, &y, &wx, &wy, &buttons); + XQueryPointer(global.display, relativeTo.GetSystemHandle(), &root, &child, &gx, &gy, &x, &y, &buttons); return Vector2i(x, y); } + +//////////////////////////////////////////////////////////// +void InputImpl::SetMousePosition(const Vector2i& position) +{ + XWarpPointer(global.display, None, global.window, 0, 0, 0, 0, position.x, position.y); + XFlush(global.display); +} + + +//////////////////////////////////////////////////////////// +void InputImpl::SetMousePosition(const Vector2i& position, const Window& relativeTo) +{ + XWarpPointer(global.display, None, relativeTo.GetSystemHandle(), 0, 0, 0, 0, position.x, position.y); + XFlush(global.display); +} + } // namespace priv } // namespace sf \ No newline at end of file diff --git a/src/SFML/Window/Linux/InputImpl.hpp b/src/SFML/Window/Linux/InputImpl.hpp index 3f3df155..5eff9b5b 100644 --- a/src/SFML/Window/Linux/InputImpl.hpp +++ b/src/SFML/Window/Linux/InputImpl.hpp @@ -65,14 +65,54 @@ public : static bool IsMouseButtonPressed(Mouse::Button button); //////////////////////////////////////////////////////////// - /// \brief Get the current position of the mouse + /// \brief Get the current position of the mouse in desktop coordinates /// - /// This function returns the mouse position in desktop coordinates. + /// This function returns the current position of the mouse + /// cursor, in global (desktop) coordinates. /// /// \return Current position of the mouse /// //////////////////////////////////////////////////////////// static Vector2i GetMousePosition(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the mouse in window coordinates + /// + /// This function returns the current position of the mouse + /// cursor, relative to the given window. + /// If no window is used, it returns desktop coordinates. + /// + /// \param relativeTo Reference window + /// + /// \return Current position of the mouse + /// + //////////////////////////////////////////////////////////// + static Vector2i GetMousePosition(const Window& relativeTo); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in desktop coordinates + /// + /// This function sets the current position of the mouse + /// cursor in global (desktop) coordinates. + /// If no window is used, it sets the position in desktop coordinates. + /// + /// \param position New position of the mouse + /// + //////////////////////////////////////////////////////////// + static void SetMousePosition(const Vector2i& position); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in window coordinates + /// + /// This function sets the current position of the mouse + /// cursor, relative to the given window. + /// If no window is used, it sets the position in desktop coordinates. + /// + /// \param position New position of the mouse + /// \param relativeTo Reference window + /// + //////////////////////////////////////////////////////////// + static void SetMousePosition(const Vector2i& position, const Window& relativeTo); }; } // namespace priv diff --git a/src/SFML/Window/Linux/WindowImplX11.cpp b/src/SFML/Window/Linux/WindowImplX11.cpp index 942c2378..ceef3500 100644 --- a/src/SFML/Window/Linux/WindowImplX11.cpp +++ b/src/SFML/Window/Linux/WindowImplX11.cpp @@ -302,30 +302,6 @@ void WindowImplX11::ShowMouseCursor(bool show) } -//////////////////////////////////////////////////////////// -void WindowImplX11::SetCursorPosition(unsigned int x, unsigned int y) -{ - XWarpPointer(myDisplay, None, myWindow, 0, 0, 0, 0, x, y); - XFlush(myDisplay); -} - - -//////////////////////////////////////////////////////////// -Vector2i WindowImplX11::GetCursorPosition() const -{ - // we don't care about these but they are required - ::Window root, child; - int gx, gy; - unsigned int buttons; - - int x = 0; - int y = 0; - XQueryPointer(myDisplay, myWindow, &root, &child, &gx, &gy, &x, &y, &buttons); - - return Vector2i(x, y); -} - - //////////////////////////////////////////////////////////// void WindowImplX11::SetPosition(int x, int y) { diff --git a/src/SFML/Window/Linux/WindowImplX11.hpp b/src/SFML/Window/Linux/WindowImplX11.hpp index 14466682..b76491b4 100644 --- a/src/SFML/Window/Linux/WindowImplX11.hpp +++ b/src/SFML/Window/Linux/WindowImplX11.hpp @@ -105,23 +105,6 @@ private : //////////////////////////////////////////////////////////// virtual void ShowMouseCursor(bool show); - //////////////////////////////////////////////////////////// - /// \brief Change the position of the mouse cursor - /// - /// \param x Left coordinate of the cursor, relative to the window - /// \param y Top coordinate of the cursor, relative to the window - /// - //////////////////////////////////////////////////////////// - virtual void SetCursorPosition(unsigned int x, unsigned int y); - - //////////////////////////////////////////////////////////// - /// \brief Get the position of the mouse cursor - /// - /// \return Current mouse cursor position, relative to the window - /// - //////////////////////////////////////////////////////////// - virtual Vector2i GetCursorPosition() const; - //////////////////////////////////////////////////////////// /// \brief Change the position of the window on screen /// diff --git a/src/SFML/Window/Mouse.cpp b/src/SFML/Window/Mouse.cpp index afb63b18..b1d35cae 100644 --- a/src/SFML/Window/Mouse.cpp +++ b/src/SFML/Window/Mouse.cpp @@ -42,17 +42,28 @@ bool Mouse::IsButtonPressed(Button button) //////////////////////////////////////////////////////////// Vector2i Mouse::GetPosition() { - const Window* focusWindow = Window::GetMouseFocusWindow(); - if (focusWindow) - { - // Position relative to the focus window - return focusWindow->GetCursorPosition(); - } - else - { - // Desktop position - return priv::InputImpl::GetMousePosition(); - } + return priv::InputImpl::GetMousePosition(); +} + + +//////////////////////////////////////////////////////////// +Vector2i Mouse::GetPosition(const Window& relativeTo) +{ + return priv::InputImpl::GetMousePosition(relativeTo); +} + + +//////////////////////////////////////////////////////////// +void Mouse::SetPosition(const Vector2i& position) +{ + priv::InputImpl::SetMousePosition(position); +} + + +//////////////////////////////////////////////////////////// +void Mouse::SetPosition(const Vector2i& position, const Window& relativeTo) +{ + priv::InputImpl::SetMousePosition(position, relativeTo); } } // namespace sf diff --git a/src/SFML/Window/OSX/InputImpl.cpp b/src/SFML/Window/OSX/InputImpl.cpp index bfd635c6..cee05ce8 100644 --- a/src/SFML/Window/OSX/InputImpl.cpp +++ b/src/SFML/Window/OSX/InputImpl.cpp @@ -55,6 +55,28 @@ Vector2i InputImpl::GetMousePosition() return Vector2i(); } + +//////////////////////////////////////////////////////////// +Vector2i InputImpl::GetMousePosition(const Window& relativeTo) +{ + // @to be implemented + return Vector2i(); +} + + +//////////////////////////////////////////////////////////// +void InputImpl::SetMousePosition(const Vector2i& position) +{ + // @to be implemented +} + + +//////////////////////////////////////////////////////////// +void InputImpl::SetMousePosition(const Vector2i& position, const Window& relativeTo) +{ + // @to be implemented +} + } // namespace priv } // namespace sf diff --git a/src/SFML/Window/OSX/InputImpl.hpp b/src/SFML/Window/OSX/InputImpl.hpp index 3d52da52..15aaf0f5 100644 --- a/src/SFML/Window/OSX/InputImpl.hpp +++ b/src/SFML/Window/OSX/InputImpl.hpp @@ -65,14 +65,54 @@ public : static bool IsMouseButtonPressed(Mouse::Button button); //////////////////////////////////////////////////////////// - /// \brief Get the current position of the mouse + /// \brief Get the current position of the mouse in desktop coordinates /// - /// This function returns the mouse position in desktop coordinates. + /// This function returns the current position of the mouse + /// cursor, in global (desktop) coordinates. /// /// \return Current position of the mouse /// //////////////////////////////////////////////////////////// static Vector2i GetMousePosition(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the mouse in window coordinates + /// + /// This function returns the current position of the mouse + /// cursor, relative to the given window. + /// If no window is used, it returns desktop coordinates. + /// + /// \param relativeTo Reference window + /// + /// \return Current position of the mouse + /// + //////////////////////////////////////////////////////////// + static Vector2i GetMousePosition(const Window& relativeTo); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in desktop coordinates + /// + /// This function sets the current position of the mouse + /// cursor in global (desktop) coordinates. + /// If no window is used, it sets the position in desktop coordinates. + /// + /// \param position New position of the mouse + /// + //////////////////////////////////////////////////////////// + static void SetMousePosition(const Vector2i& position); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in window coordinates + /// + /// This function sets the current position of the mouse + /// cursor, relative to the given window. + /// If no window is used, it sets the position in desktop coordinates. + /// + /// \param position New position of the mouse + /// \param relativeTo Reference window + /// + //////////////////////////////////////////////////////////// + static void SetMousePosition(const Vector2i& position, const Window& relativeTo); }; } // namespace priv diff --git a/src/SFML/Window/OSX/WindowImplCocoa.hpp b/src/SFML/Window/OSX/WindowImplCocoa.hpp index 6013abfa..cadf97c2 100644 --- a/src/SFML/Window/OSX/WindowImplCocoa.hpp +++ b/src/SFML/Window/OSX/WindowImplCocoa.hpp @@ -255,23 +255,6 @@ private: /// //////////////////////////////////////////////////////////// virtual void ShowMouseCursor(bool show); - - //////////////////////////////////////////////////////////// - /// \brief Change the position of the mouse cursor - /// - /// \param x Left coordinate of the cursor, relative to the window - /// \param y Top coordinate of the cursor, relative to the window - /// - //////////////////////////////////////////////////////////// - virtual void SetCursorPosition(unsigned int x, unsigned int y); - - //////////////////////////////////////////////////////////// - /// \brief Get the position of the mouse cursor - /// - /// \return Current mouse cursor position, relative to the window - /// - //////////////////////////////////////////////////////////// - virtual Vector2i GetCursorPosition() const; //////////////////////////////////////////////////////////// /// \brief Change the position of the window on screen diff --git a/src/SFML/Window/OSX/WindowImplCocoa.mm b/src/SFML/Window/OSX/WindowImplCocoa.mm index 57866623..84c4ae82 100644 --- a/src/SFML/Window/OSX/WindowImplCocoa.mm +++ b/src/SFML/Window/OSX/WindowImplCocoa.mm @@ -338,21 +338,6 @@ void WindowImplCocoa::ShowMouseCursor(bool show) } -//////////////////////////////////////////////////////////// -void WindowImplCocoa::SetCursorPosition(unsigned int x, unsigned int y) -{ - [myDelegate setCursorPositionToX:x Y:y]; -} - - -//////////////////////////////////////////////////////////// -Vector2i WindowImplCocoa::GetCursorPosition() const -{ - // @to be implemented - return Vector2i(); -} - - //////////////////////////////////////////////////////////// void WindowImplCocoa::SetPosition(int x, int y) { diff --git a/src/SFML/Window/Win32/InputImpl.cpp b/src/SFML/Window/Win32/InputImpl.cpp index 6845be41..2c509173 100644 --- a/src/SFML/Window/Win32/InputImpl.cpp +++ b/src/SFML/Window/Win32/InputImpl.cpp @@ -27,6 +27,7 @@ //////////////////////////////////////////////////////////// #define _WIN32_WINDOWS 0x0501 #define _WIN32_WINNT 0x0501 +#include #include #include @@ -168,10 +169,35 @@ bool InputImpl::IsMouseButtonPressed(Mouse::Button button) //////////////////////////////////////////////////////////// Vector2i InputImpl::GetMousePosition() { - POINT position; - GetCursorPos(&position); + POINT point; + GetCursorPos(&point); + return Vector2i(point.x, point.y); +} - return Vector2i(position.x, position.y); + +//////////////////////////////////////////////////////////// +Vector2i InputImpl::GetMousePosition(const Window& relativeTo) +{ + POINT point; + GetCursorPos(&point); + ScreenToClient(relativeTo.GetSystemHandle(), &point); + return Vector2i(point.x, point.y); +} + + +//////////////////////////////////////////////////////////// +void InputImpl::SetMousePosition(const Vector2i& position) +{ + SetCursorPos(position.x, position.y); +} + + +//////////////////////////////////////////////////////////// +void InputImpl::SetMousePosition(const Vector2i& position, const Window& relativeTo) +{ + POINT point = {position.x, position.y}; + ClientToScreen(relativeTo.GetSystemHandle(), &point); + SetCursorPos(point.x, point.y); } } // namespace priv diff --git a/src/SFML/Window/Win32/InputImpl.hpp b/src/SFML/Window/Win32/InputImpl.hpp index 5870f4f1..23c71b10 100644 --- a/src/SFML/Window/Win32/InputImpl.hpp +++ b/src/SFML/Window/Win32/InputImpl.hpp @@ -65,14 +65,54 @@ public : static bool IsMouseButtonPressed(Mouse::Button button); //////////////////////////////////////////////////////////// - /// \brief Get the current position of the mouse + /// \brief Get the current position of the mouse in desktop coordinates /// - /// This function returns the mouse position in desktop coordinates. + /// This function returns the current position of the mouse + /// cursor, in global (desktop) coordinates. /// /// \return Current position of the mouse /// //////////////////////////////////////////////////////////// static Vector2i GetMousePosition(); + + //////////////////////////////////////////////////////////// + /// \brief Get the current position of the mouse in window coordinates + /// + /// This function returns the current position of the mouse + /// cursor, relative to the given window. + /// If no window is used, it returns desktop coordinates. + /// + /// \param relativeTo Reference window + /// + /// \return Current position of the mouse + /// + //////////////////////////////////////////////////////////// + static Vector2i GetMousePosition(const Window& relativeTo); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in desktop coordinates + /// + /// This function sets the current position of the mouse + /// cursor in global (desktop) coordinates. + /// If no window is used, it sets the position in desktop coordinates. + /// + /// \param position New position of the mouse + /// + //////////////////////////////////////////////////////////// + static void SetMousePosition(const Vector2i& position); + + //////////////////////////////////////////////////////////// + /// \brief Set the current position of the mouse in window coordinates + /// + /// This function sets the current position of the mouse + /// cursor, relative to the given window. + /// If no window is used, it sets the position in desktop coordinates. + /// + /// \param position New position of the mouse + /// \param relativeTo Reference window + /// + //////////////////////////////////////////////////////////// + static void SetMousePosition(const Vector2i& position, const Window& relativeTo); }; } // namespace priv diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index d440260e..dd11178c 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -231,26 +231,6 @@ void WindowImplWin32::ShowMouseCursor(bool show) } -//////////////////////////////////////////////////////////// -void WindowImplWin32::SetCursorPosition(unsigned int x, unsigned int y) -{ - POINT position = {x, y}; - ClientToScreen(myHandle, &position); - SetCursorPos(position.x, position.y); -} - - -//////////////////////////////////////////////////////////// -Vector2i WindowImplWin32::GetCursorPosition() const -{ - POINT position; - GetCursorPos(&position); - ScreenToClient(myHandle, &position); - - return Vector2i(position.x, position.y); -} - - //////////////////////////////////////////////////////////// void WindowImplWin32::SetPosition(int x, int y) { diff --git a/src/SFML/Window/Win32/WindowImplWin32.hpp b/src/SFML/Window/Win32/WindowImplWin32.hpp index c8120874..047e279f 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.hpp +++ b/src/SFML/Window/Win32/WindowImplWin32.hpp @@ -94,23 +94,6 @@ private : //////////////////////////////////////////////////////////// virtual void ShowMouseCursor(bool show); - //////////////////////////////////////////////////////////// - /// \brief Change the position of the mouse cursor - /// - /// \param x Left coordinate of the cursor, relative to the window - /// \param y Top coordinate of the cursor, relative to the window - /// - //////////////////////////////////////////////////////////// - virtual void SetCursorPosition(unsigned int x, unsigned int y); - - //////////////////////////////////////////////////////////// - /// \brief Get the position of the mouse cursor - /// - /// \return Current mouse cursor position, relative to the window - /// - //////////////////////////////////////////////////////////// - virtual Vector2i GetCursorPosition() const; - //////////////////////////////////////////////////////////// /// \brief Change the position of the window on screen /// diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index 5831939a..b2ebfc05 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -242,21 +242,6 @@ void Window::ShowMouseCursor(bool show) } -//////////////////////////////////////////////////////////// -void Window::SetCursorPosition(unsigned int x, unsigned int y) -{ - if (myWindow) - myWindow->SetCursorPosition(x, y); -} - - -//////////////////////////////////////////////////////////// -Vector2i Window::GetCursorPosition() const -{ - return myWindow ? myWindow->GetCursorPosition() : Vector2i(0, 0); -} - - //////////////////////////////////////////////////////////// void Window::SetPosition(int x, int y) { diff --git a/src/SFML/Window/WindowImpl.hpp b/src/SFML/Window/WindowImpl.hpp index 8323795d..86a24fcf 100644 --- a/src/SFML/Window/WindowImpl.hpp +++ b/src/SFML/Window/WindowImpl.hpp @@ -141,23 +141,6 @@ public : //////////////////////////////////////////////////////////// virtual void ShowMouseCursor(bool show) = 0; - //////////////////////////////////////////////////////////// - /// \brief Change the position of the mouse cursor - /// - /// \param x Left coordinate of the cursor, relative to the window - /// \param y Top coordinate of the cursor, relative to the window - /// - //////////////////////////////////////////////////////////// - virtual void SetCursorPosition(unsigned int x, unsigned int y) = 0; - - //////////////////////////////////////////////////////////// - /// \brief Get the position of the mouse cursor - /// - /// \return Current mouse cursor position, relative to the window - /// - //////////////////////////////////////////////////////////// - virtual Vector2i GetCursorPosition() const = 0; - //////////////////////////////////////////////////////////// /// \brief Change the position of the window on screen ///