Created
September 18, 2013 02:30
-
-
Save anunyin/6603693 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// windowHandle is a pointer to an SDL_Window object, acquired and stored from your original call to SDL_CreateWindow | |
SDL_DestroyWindow(windowHandle); | |
// You'll probably want to keep the window title and window position unchanged | |
// by caching those values before you destroy the previous window. | |
windowHandle = SDL_CreateWindow("Window Title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, newWidth, newHeight, SDL_WINDOW_OPENGL); | |
// windowContext is an SDL_GLContext object, acquired and stored from your initial SDL_GL_CreateContext call. | |
SDL_GL_MakeCurrent(windowHandle, windowContext); | |
// Still needs to be called to update the rendered area. | |
glViewport(newWidth, newHeight); | |
// There seems to be a bug where if relative mouse mouse is enabled when you create a new window, | |
// the window still reports that it has input & mouse focus, but it doesn't send any events for | |
// mouse motion or mouse button clicks. You can fix this by turning relative mouse mode on and off. | |
if (SDL_GetRelativeMouseMode()) | |
{ | |
SDL_SetRelativeMouseMode(SDL_FALSE); | |
SDL_SetRelativeMouseMode(SDL_TRUE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment