Hello All, I am trying to clean up some polish bugs with the Shanghai game I am working on and I am currently stuck on trying to get the right event for detecting when the user has changed the desktop resolution.
I have tried trapping the following events: 1) SDL_ACTIVEEVENT 2) SDL_VIDEOEXPOSE 3) SDL_VIDEORESIZE These are the events that are passed through to pygame as pygame.ACTIVEEVENT and so on... #3 - SDL_VIDEORESIZE This is what I looked at first and I was wrong, this is only for the WINDOW being resized... not the desktop resoltion #2 - SDL_VIDEOEXPOSE After watching the events in a debugger when I change the desktop resolution I find out that this IS the event that is generated from changing the desktop resolution. Okay no problem right? Time to call: self.screen = self.pygame.display.set_mode( size ) and draw() again right? Well sure, now my game repaints properly when the desktop resolution changes. So What is the problem? Well now EVERY TIME another window draws on top of my game's window a SDL_VIDEOEXPOSE event is triggered. There does not appear to be any flags associated with this event. So I am having trouble distinguishing from an overlapping window and changing the desktop resolution. So I tried this: 1) call pygame.display.Info() at the startup of my game and save off this structure 2) call it again after getting a SDL_VIDEOEXPOSE event and comparing to see if it has changed at all. The problem with this is that apparantly the VidInfo structure DOES NOT change when changing desktop resolution... So then I tried using SDL_ACTIVEEVENT and simply leaving the display black and unpainted after the user changes the resolution until the user rolls the mouse over the game window and bringing it back to focus. This works. However, it gets annoying watching the screen repaint everytime the window gains focus.... Do you guys have any leads for me to try? This HAS to be a problem solved many times before... Thank you, -Erik -- http://mail.python.org/mailman/listinfo/python-list
