mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-22 21:09:45 +00:00
Avoid warping the mouse cursor more than necessary
Apparently, the SDL_WarpMouseInWindow can be very expensive (anywhere from 0.1-5ms) due to XSync() in the implementation. This was causing no-grab=1 configurations to suffer from terrible stuttering when turning the view.
This commit is contained in:
parent
a8517c34eb
commit
c1fe9f2a89
1 changed files with 2 additions and 2 deletions
|
@ -329,8 +329,8 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
|
||||||
|
|
||||||
SDL_GetWindowSize(mSDLWindow, &width, &height);
|
SDL_GetWindowSize(mSDLWindow, &width, &height);
|
||||||
|
|
||||||
const int FUDGE_FACTOR_X = width;
|
const int FUDGE_FACTOR_X = width/4;
|
||||||
const int FUDGE_FACTOR_Y = height;
|
const int FUDGE_FACTOR_Y = height/4;
|
||||||
|
|
||||||
//warp the mouse if it's about to go outside the window
|
//warp the mouse if it's about to go outside the window
|
||||||
if(evt.x - FUDGE_FACTOR_X < 0 || evt.x + FUDGE_FACTOR_X > width
|
if(evt.x - FUDGE_FACTOR_X < 0 || evt.x + FUDGE_FACTOR_X > width
|
||||||
|
|
Loading…
Reference in a new issue