[AD] Python wrapper

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I made an automated Python wrapper for A5. It simply uses ctypes
(Python's foreign function interface) to put each Allegro function, type
and constant into the namespace of an allegro module. So not a
"Pythonic" wrapper at all, but great if you want to convert an existing
C game into Python as I've been doing for most of my personal C/C++
code :)

Here's how ex_draw_bitmap.c looks as Python using that wrapper:

http://wiki.allegro.cc/index.php?title=Python

Performance is about the same as the C version here from what I can see.

Right now this only works in Linux and you have to manually adjust the
path to the .so files - but that's easy to fix as ctypes has helpers for
finding DLLs on all platforms. This just was done as a quick test.

Since the allegro.py is auto-generated, I guess there's no need of
adding it to SVN, but I'll put the generator script into a "python"
folder after cleaning it up a bit.

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/