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

[pygame] Re: SDL-ctypes progress



Hi,

nice work!

Sending messages to the pygame mailing list is probably a good idea.
So anyone can check your progress and reply.

I ran testvidinfo.py ok on my debian linux, X11 system.

Binary compatibility, and changing compilers are probably the harder
bits.  When SDL 1.3 comes out there is going to be a slightly
different api, and abi.  Also with each 1.2 release there it will be
slightly different.  Have you seen how pypy uses the compiler to check
the sizeof things?  That might be worth researching to check the api.

A note on your licence.  SDL and pygame are both licenced LGPL,
whereas yours is licenced MIT.  Is there a reason for chosing MIT?

Pete has asked the seul people about svn, and is arranging it.

Following pyopengls methods for using numeric/numpy for ->pixels is a
good plan.  For the future, in 2.5 there has been work on writable
buffers.  Also there is a SoC project which aims to get a simple
numeric like interface into python.

pygame uses it's own documentation generation scripts.  I've not had
any luck with any of the autodoc type python tools.



Cheers!



On 6/2/06, Alex Holkner <aholkner@xxxxxxxxxxxxxx> wrote:
Hello all, here's my first weekly-ish progress update.

I've made a start on wrapping SDL.  Most of SDL_video.h, SDL_error.h,
SDL_rwops.h, SDL_timer.h, SDL_version.h, and all the #defines have been
wrapped.  Things that work:

 * I've ported test/testvidinfo.c to Python with only minor changes and
it works perfectly, and fast.
 * I've changed the signature of some functions so that instead of
passing by reference, they return the value directly; for example, see
SDL_GetClipRect.
 * Functions that take or return an array, I've modified to take or
return a Python list.
 * RWops work both as an opaque type (e.g., as a value to pass from
SDL_Load* to SDL_CreateSurface*), and as a wrapper around any Python
file-type object (only tested reading a bitmap so far).
 * There's a couple of unit tests written also, but not many.

Things that don't work yet:

 * Haven't wrapped any of the enums yet -- I will do these the same as
constants for now, unless someone has a better idea.
 * SDL_VideoInfo has bitfields... these are problematic, since compilers
are allowed to do anything they like with them.  At the moment I have
them reading correctly for my AMD64/gcc system, but there's no guarantee
it will work for any other combination.
 * The GL_* constants should probably be stripped out (there is a script
that generates these constants)

Things that need thinking about:

 * I'm not doing anything useful with SDL_Surface.pixels yet, which is a
void *.  There are also a couple of functions that take arrays of ints
that I'm ignoring for now.  I guess here is where we think about doing
conversions to/from strings, lists, numarray, numpy, numeric etc a la
PyOpenGL-ctypes.
 * I want to be able to autogenerate documentation.  Epydoc doesn't pick
up the docstrings on most of my wrapper functions though... does anyone
know of a tool that might work, or an easy way to patch epydoc?
Otherwise I'm willing to spend a couple of days writing/modifying
something with docutils to do it, rather than writing all the
documentation by hand.

I'm using a SVN repository on my home computer at the moment, let me
know when the pygame one starts existing, or if I should just use CVS on
pygame.

I've put a snapshot of the code at
http://www.pygame.org/ctypes/SDL-ctypes-0.01.tar.gz.  It _requires_ SDL
1.2.10 (I was erroneously using 1.2.8 earlier and some structs are
actually defined differently... this could be a problem in the future, I
suspect).  The test/testvidinfo.py script  is probably the most
interesting thing to run.

Cheers
Alex.