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

Re: [pygame] Mixing Python and C in games



I used SWIG for my Fractal Tetris game -- the C portion generates the fractals.  The setup.py I created works both on linux and on windows to generate py2exe.  I'm not sure if my example is the best way to do things, but it might help you get started with SWIG.  (Of particular note, my example shows how to access a pygame's SDL Surface via SWIG.)

http://www.imitationpickles.org/ftetris/

Hope that helps!
Phil

Sami Hangaslammi <sami.hangaslammi@xxxxxxxxx> wrote:
On 2/17/06, David Mikesell wrote:
> I'm not completely clear on what your trying to do - are you wanting to
> wrap C code in Python? If so, have you looked at SWIG? I used SWIG to
> wrap C++ code in Perl a few years back and it was fairly easy.

What I'm trying to do, is to rewrite some of the algorithms in my
framework in C (it's currently 100% Python). I guess SWIG is an option
too, although it also gave me the impression that its better suited to
wrapping a whole, exisiting C-library for Python.

--
Sami Hangaslammi


Yahoo! Mail
Use Photomail to share photos without annoying attachments.