fix window dimensions when starting in fullscreen
parent
bd3e70b096
commit
2ae116c72b
|
@ -45,17 +45,21 @@ namespace MoonWorks
|
||||||
|
|
||||||
ScreenMode = windowCreateInfo.ScreenMode;
|
ScreenMode = windowCreateInfo.ScreenMode;
|
||||||
|
|
||||||
|
SDL.SDL_GetDesktopDisplayMode(0, out var displayMode);
|
||||||
|
|
||||||
Handle = SDL.SDL_CreateWindow(
|
Handle = SDL.SDL_CreateWindow(
|
||||||
windowCreateInfo.WindowTitle,
|
windowCreateInfo.WindowTitle,
|
||||||
SDL.SDL_WINDOWPOS_UNDEFINED,
|
SDL.SDL_WINDOWPOS_CENTERED,
|
||||||
SDL.SDL_WINDOWPOS_UNDEFINED,
|
SDL.SDL_WINDOWPOS_CENTERED,
|
||||||
(int) windowCreateInfo.WindowWidth,
|
windowCreateInfo.ScreenMode == ScreenMode.Windowed ? (int) windowCreateInfo.WindowWidth : displayMode.w,
|
||||||
(int) windowCreateInfo.WindowHeight,
|
windowCreateInfo.ScreenMode == ScreenMode.Windowed ? (int) windowCreateInfo.WindowHeight : displayMode.h,
|
||||||
flags
|
flags
|
||||||
);
|
);
|
||||||
|
|
||||||
Width = windowCreateInfo.WindowWidth;
|
/* Requested size might be different in fullscreen, so let's just get the area */
|
||||||
Height = windowCreateInfo.WindowHeight;
|
SDL.SDL_GetWindowSize(Handle, out var width, out var height);
|
||||||
|
Width = (uint) width;
|
||||||
|
Height = (uint) height;
|
||||||
|
|
||||||
idLookup.Add(SDL.SDL_GetWindowID(Handle), this);
|
idLookup.Add(SDL.SDL_GetWindowID(Handle), this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue