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

Re: [pygame] SDL-ctypes progress



Hello,

probably some stuff in SDL_syswm.h would be useful.  For accessing the
system events.  eg, the windows event, or the X event.


On 6/6/06, Alex Holkner <aholkner@xxxxxxxxxxxxxx> wrote:
Hello all those interested,

I've uploaded a new snapshot of my work:
http://pygame.org/ctypes/SDL-ctypes-0.02.tar.gz

Basically everything in SDL 1.2.10 is wrapped now, except for the audio
and joystick submodules.  Other changes are:

 * Complete HTML API documentation (in doc/).
 * No more error return codes; SDL_Exception is raised instead, just
like PyOpenGL does.
 * A numpy interface to SDL_Surface.pixels
 * A few more test scripts, but nothing to get excited about

The most exciting thing you can do with this snapshot is run
tests/pixels_numpy.py (assuming you have numpy installed), which
implements one of those old-school plasma effects.

I welcome input as to how to implement the numpy interface.  Currently
I've just defined a method on SDL_Surface, "get_pixels_numpy()".  There
are a few more places where something like this is needed, especially in
audio.  I'm happy to have the library provide separate functions for
each type of array interface (possibly string, list, ctypes array,
numpy, python array, ...).  Alternatively, there could be a global
interface selected during initialisation (this is how PyOpenGL works,
but I'm not too keen on it).

I'm not planning to wrap the following SDL headers, because I don't
think they provide anything useful to Python programmers.  Let me know
if you disagree:

  SDL_cpuinfo.h
  SDL_endian.h
  SDL_loadso.h
  SDL_main.h
  SDL_mutex.h
  SDL_syswm.h
  SDL_thread.h

What's left for SDL wrapping?

 * Not yet tested on anything other than Linux/AMD64.
 * Currently works only with 1.2.10; I need to provide binary
compatibility with earlier (and later?) SDL versions.
 * Not all enums have been wrapped, and I've possibly missed a few
constants.
 * The aforementioned numpy/array interface
 * Classes and their fields are not yet documented
 * Some isolated functions not yet implemented, mainly because I'm
waiting on a decision on the numpy/array interface before proceeding.
 * Implementing the remaining test programs provided with SDL, and
writing some more to give better coverage.

Alex.