recenter window on windowed mode change

pull/50/head
cosmonaut 2023-06-09 11:42:20 -07:00
parent 00366cc9d4
commit b1fe7f96b2
1 changed files with 12 additions and 2 deletions

View File

@ -73,9 +73,14 @@ namespace MoonWorks
windowFlag = SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP; windowFlag = SDL.SDL_WindowFlags.SDL_WINDOW_FULLSCREEN_DESKTOP;
} }
ScreenMode = screenMode;
SDL.SDL_SetWindowFullscreen(Handle, (uint) windowFlag); SDL.SDL_SetWindowFullscreen(Handle, (uint) windowFlag);
if (screenMode == ScreenMode.Windowed)
{
SDL.SDL_SetWindowPosition(Handle, SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED);
}
ScreenMode = screenMode;
} }
/// <summary> /// <summary>
@ -89,6 +94,11 @@ namespace MoonWorks
SDL.SDL_SetWindowSize(Handle, (int) width, (int) height); SDL.SDL_SetWindowSize(Handle, (int) width, (int) height);
Width = width; Width = width;
Height = height; Height = height;
if (ScreenMode == ScreenMode.Windowed)
{
SDL.SDL_SetWindowPosition(Handle, SDL.SDL_WINDOWPOS_CENTERED, SDL.SDL_WINDOWPOS_CENTERED);
}
} }
internal static Window Lookup(uint windowID) internal static Window Lookup(uint windowID)