Browse Source

Sdl2Application: also lock cursor to window when locking mouse.

pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
7cdbad0557
  1. 5
      src/Platform/Sdl2Application.cpp
  2. 4
      src/Platform/Sdl2Application.h

5
src/Platform/Sdl2Application.cpp

@ -135,6 +135,11 @@ int Sdl2Application::exec() {
return 0;
}
void Sdl2Application::setMouseLocked(bool enabled) {
SDL_SetWindowGrab(window, enabled ? SDL_TRUE : SDL_FALSE);
SDL_SetRelativeMouseMode(enabled ? SDL_TRUE : SDL_FALSE);
}
Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseEvent::modifiers() {
if(modifiersLoaded) return _modifiers;
modifiersLoaded = true;

4
src/Platform/Sdl2Application.h

@ -135,9 +135,7 @@ class Sdl2Application {
* MouseMoveEvent::relativePosition() is changing, absolute position
* stays the same.
*/
inline void setMouseLocked(bool enabled) {
SDL_SetRelativeMouseMode(enabled ? SDL_TRUE : SDL_FALSE);
}
void setMouseLocked(bool enabled);
protected:
/**

Loading…
Cancel
Save