Browse Source

Platform: deprecate Sdl2Application::setMouseLocked().

Now also handled by the new setCursor() APIs.
pull/388/head
Vladimír Vondruš 7 years ago
parent
commit
c4e3e3c045
  1. 4
      doc/changelog.dox
  2. 2
      src/Magnum/Platform/Sdl2Application.cpp
  3. 23
      src/Magnum/Platform/Sdl2Application.h

4
doc/changelog.dox

@ -79,6 +79,10 @@ See also:
related enum & getter are deprecated in favor of the new extended and more
flexible @ref Platform::GlfwApplication::setCursor(). The setting didn't
allow changing the cursor later, which made it pretty useless.
- @cpp Platform::Sdl2Application::Configuration::setMouseLocked() @ce and
@cpp Platform::Sdl2Application::Configuration::isMouseLocked() @ce is
deprecated in favor of the new @ref Platform::Sdl2Application::setCursor()
together with @ref Platform::Sdl2Application::Cursor::HiddenLocked
@section changelog-2019-10 2019.10

2
src/Magnum/Platform/Sdl2Application.cpp

@ -974,6 +974,7 @@ Sdl2Application::Cursor Sdl2Application::cursor() {
#endif
}
#ifdef MAGNUM_BUILD_DEPRECATED
void Sdl2Application::setMouseLocked(bool enabled) {
/** @todo Implement this in Emscripten */
#ifndef CORRADE_TARGET_EMSCRIPTEN
@ -984,6 +985,7 @@ void Sdl2Application::setMouseLocked(bool enabled) {
static_cast<void>(enabled);
#endif
}
#endif
bool Sdl2Application::isTextInputActive() {
#ifndef CORRADE_TARGET_EMSCRIPTEN

23
src/Magnum/Platform/Sdl2Application.h

@ -854,8 +854,9 @@ class Sdl2Application {
#ifndef CORRADE_TARGET_EMSCRIPTEN
/**
* Hidden and locked.
*
* Hidden and locked. When the mouse is locked, only
* @ref MouseMoveEvent::relativePosition() is changing, absolute
* position stays the same.
* @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten".
*/
HiddenLocked
@ -883,17 +884,23 @@ class Sdl2Application {
}
#endif
/** @brief Whether mouse is locked */
bool isMouseLocked() const { return SDL_GetRelativeMouseMode(); }
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @brief Whether mouse is locked
*
* @deprecated Use @ref cursor() together with
* @ref Cursor::HiddenLocked instead.
*/
CORRADE_DEPRECATED("use cursor() together with Cursor::HiddenLocked instead") bool isMouseLocked() const { return SDL_GetRelativeMouseMode(); }
/**
* @brief Enable or disable mouse locking
*
* When mouse is locked, the cursor is hidden and only
* @ref MouseMoveEvent::relativePosition() is changing, absolute
* position stays the same.
* @deprecated Use @ref setCursor() together with
* @ref Cursor::HiddenLocked instead.
*/
void setMouseLocked(bool enabled);
CORRADE_DEPRECATED("use setCursor() together with Cursor::HiddenLocked instead") void setMouseLocked(bool enabled);
#endif
private:
/**

Loading…
Cancel
Save