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

Re: [pygame] Advice on Game Engine




On May 3, 2005, at 11:34 PM, Jasper wrote:

Bob Ippolito wrote:



On May 3, 2005, at 9:55 PM, Jasper wrote:



OpenGL offers a 2D game smooth scrolling, zooming and rotation. There are several frameworks like Pyui (which is ok, but defunct) built on top of OpenGL+Pygame, but you can also combine it with something like wxPython if you don't need much control over your widgets.




You can't combine ANY GUI toolkit (wxPython, GTK, etc.) with pygame in a cross-platform fashion, because SDL sacrifices that feature for platform independence and ease of development. If you're using wxPython, you're going to have to toss pygame, or run them in separate processes (threads is not good enough cross- platform).

Good point about crossplatform-ness. I only played around with it a little, but by my recollection you didn't have to run pygame and wxPython in seperate processes or seperate threads, although it was a bit of a pain in the ass to get them to work together (especially if you wanted Twisted too) as each part wanted it's mainloop to be in charge.

Well I have written a reactor for Twisted that allows a foreign event loop to be in charge, so long as it has a thread safe and hopefully fast way to send a message to the main event loop <http:// bob.pythonmac.org/archives/2005/04/17/twisted-and-foreign-event-loops/>.


This scheme isn't sufficient to integrate two GUI frameworks cross- platform, because there are other problems that have nothing to do with Twisted. However, it does make using Twisted painless in just about any reasonably sane scenario (using Twisted plus one of PyObjC, wxPython, pygame, etc.).

What makes you say they need to be in seperate processes?

Because wxWidgets and SDL can't live in the same process at the same time on all platforms. Mac OS X can only have one main event loop, and it must be the main thread, so you get one or the other. Other platforms may or may not have similar issues, but in general, integrating two GUI frameworks in the same application is a loaded gun and a suicide note unless those two frameworks were explicitly designed to interoperate.


-bob