[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[pygame] pygame for OSX
It dawned on me a couple days ago that with PyObjC as far as it is, and
using some of the tricks that they used, it'd be possible to make
*completely self-contained* pygame applications that run on OS X 10.2+
using the installed python.
It'll take me a few days to find the time to write up a full
explanation, make a project builder template, etc., but essentially I
removed SDL_main.m (and the StartTheApplication() call from base.c),
and I had to rename time.c to pygametime.c (arbitrary rename choice)
and include a python module (time.py) that imported the namespace from
pygametime.. this is due to a bug in the extension loader of python 2.2
that Apple compiled.
I used the bootstrapping code from the PyObjC template, and in an
application delegate I start the pygame stuff when the application is
finished loading. I put SDL, pygame, pyobjc, etc. in the app bundle..
and voila, everything works, just perfectly.
As a quick proof of concept, I've ported Pete's excellent solarwolf
1.1: http://www2.mastersofbranding.com/~bob/solarwolf.dmg.tgz
I also changed the first couple lines of solarwolf so it wouldn't
change directories based on argv[0], and to add os.getcwd() to the
sys.path.insert call.. but that was it.
tgz'ed, this disk image is only about 6 megabytes and provides
*everything* required to run solarwolf on a stock OS X 10.2+ machine!
The package could be stripped a bit further, but 6 megs is pretty
acceptable in my book.
It runs fullscreen, and performance is just fine even on an older
tibook g4-400, and of course, it also runs excellent on my tibook
g4-1ghz (a 15", not the new models).
-bob
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org