From Jeremy Moles, "This extra call to SDL_VideoSetMode() prevents my viewport from getting

all wonky when I resize the SDL window. I'm not sure if this bug has
always existed or not, but according to the SDL documentation this
operation should be safe regardless, and doesn't not introduce the need
for extra memory management (that is: there is no need to "cleanup" the
old screen variable, that is all handled by SDL for us).
"
This commit is contained in:
Robert Osfield 2007-12-08 15:04:47 +00:00
parent 13e8af6305
commit 0120bae9f7

View File

@ -99,11 +99,11 @@ int main( int argc, char **argv )
const SDL_version* linked_version = SDL_Linked_Version(); const SDL_version* linked_version = SDL_Linked_Version();
if(linked_version->major == 1 && linked_version->minor == 2) if(linked_version->major == 1 && linked_version->minor == 2)
{ {
if(linked_version->patch < 10) if(linked_version->patch < 10)
{ {
windowWidth = 1280; windowWidth = 1280;
windowHeight = 1024; windowHeight = 1024;
} }
} }
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
@ -146,6 +146,7 @@ int main( int argc, char **argv )
switch (event.type) { switch (event.type) {
case SDL_VIDEORESIZE: case SDL_VIDEORESIZE:
SDL_SetVideoMode(event.resize.w, event.resize.h, bitDepth, SDL_OPENGL | SDL_RESIZABLE);
gw->resized(0, 0, event.resize.w, event.resize.h ); gw->resized(0, 0, event.resize.w, event.resize.h );
break; break;