Merge pull request #66 from twolife/toggle-fullscreen

don't rebuild GL context to toggle fullscreen
This commit is contained in:
ptitSeb 2023-05-04 16:49:35 +02:00 committed by GitHub
commit 537f498d47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1047,10 +1047,22 @@ int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
// toggle full-screen on alt-enter
if( msg.message==WM_SYSKEYDOWN && msg.wParam==VK_RETURN && !IsIconic(_hwndMain)) {
// !!! FIXME: SDL doesn't need to rebuild the GL context here to toggle fullscreen.
STUBBED("SDL doesn't need to rebuild the GL context here...");
#ifdef PLATFORM_WIN32
StartNewMode( (GfxAPIType)sam_iGfxAPI, sam_iDisplayAdapter, sam_iScreenSizeI, sam_iScreenSizeJ,
(enum DisplayDepth)sam_iDisplayDepth, !sam_bFullScreenActive);
#else
int res = SDL_SetWindowFullscreen((SDL_Window *) _hwndMain, sam_bFullScreenActive ? 0 : SDL_WINDOW_FULLSCREEN);
if (res == 0) {
sam_bFullScreenActive = !sam_bFullScreenActive;
char achWindowTitle[256];
if (sam_bFullScreenActive)
SDL_snprintf( achWindowTitle, sizeof (achWindowTitle), TRANS("Serious Sam (FullScreen %dx%d)"), sam_iScreenSizeI, sam_iScreenSizeJ);
else
SDL_snprintf( achWindowTitle, sizeof (achWindowTitle), TRANS("Serious Sam (Window %dx%d)"), sam_iScreenSizeI, sam_iScreenSizeJ);
SDL_SetWindowTitle((SDL_Window *) _hwndMain, achWindowTitle);
} else
CPrintF("Can't toggle full-screen : %s\n", SDL_GetError());
#endif
if (_pInput != NULL) // rcg02042003 hack for SDL vs. Win32.
_pInput->ClearRelativeMouseMotion();