Removing requirement to restart game after applying changes to mouse focus option. The setting now defaults to 'false' as it is likely to be disruptive to players who are used to the usual behaviour in windowed mode.

This commit is contained in:
Gordon Martin
2014-06-10 13:56:58 +01:00
parent b8cdb224d1
commit 89c9499909
9 changed files with 56 additions and 19 deletions

View File

@@ -63,8 +63,10 @@ namespace OpenRA.Renderer.Sdl2
window = SDL.SDL_CreateWindow("OpenRA", SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED, size.Width, size.Height, SDL.SDL_WindowFlags.SDL_WINDOW_OPENGL);
var lockWindow = Game.Settings.Game.LockMouseWindow ? SDL.SDL_bool.SDL_TRUE : SDL.SDL_bool.SDL_FALSE;
SDL.SDL_SetWindowGrab(window, lockWindow);
if (Game.Settings.Game.LockMouseWindow)
GrabWindowMouseFocus();
else
ReleaseWindowMouseFocus();
if (windowMode == WindowMode.Fullscreen)
SDL.SDL_SetWindowFullscreen(window, (uint)SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN);
@@ -199,6 +201,16 @@ namespace OpenRA.Renderer.Sdl2
ErrorHandler.CheckGlError();
}
public void GrabWindowMouseFocus()
{
SDL.SDL_SetWindowGrab(window, SDL.SDL_bool.SDL_TRUE);
}
public void ReleaseWindowMouseFocus()
{
SDL.SDL_SetWindowGrab(window, SDL.SDL_bool.SDL_FALSE);
}
public void EnableScissor(int left, int top, int width, int height)
{
if (width < 0)