[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Minimizing hardware-accelerated application



Heikki Salo wrote:

I am making a little test program with pygame and I have noticed all the
problems using hardware-acceleration. However, in my game using hardware
significantly improves the performance so I would at least to keep it as an
option.

Here is where my problem occurs. When iconizing the application (in HW-mode)
the pygame crashes and says that "pygame.error: Surface was lost". I believe
that this is the normal behaviour and when losing/gaining focus the program
should reaquire the old mode somehow. I have managed to use ACTIVEEVENT and
"pygame.display.toggle_fullscreen()" so that it is ok to iconize the
application, but when toggling back to fullscreen the program crashes with
that surface lost-error. What is the "normal" thing to do in order to
prevent those crashes? Any example would be nice.



You could try pygame.display.quit(), then make a new display once you become unminimized. As pygame.display.toggle_fullscreen() isn't cross platform anyway(only works on linux I think).