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

Fwd: Re: [pygame] SDL-ctypes progress



Forwarded message from Mike Fletcher:
---------------------------------------------------------

Peter Shinners wrote:
> On Tue, 2006-06-06 at 01:29 +1000, Alex Holkner wrote:
>   
>> I've uploaded a new snapshot of my work:  
>> http://pygame.org/ctypes/SDL-ctypes-0.02.tar.gz
>>     
...
> I thought the PyOpenGL ctypes could take arguments from any of the
array
> modules, but always returned a new array with a globally registered
> type. If this is true, it would be good if the SDL code could accept
> arrays from any type of array.
>   

Yes, OpenGL-ctypes accepts any supported array input type and produces
the globally-registered type when creating new arrays.  I'm not actually
thrilled with the global registration, but it was the best API that came
to mind that didn't require altering client code written for PyOpenGL.

> I'm wondering if we can just always have SDL functions return new
> "ctypes" style arrays. Then provide convenience functions for wrapping
> those into array types for other libraries.
>     pal = mysurf.format.palette
>     palette = SDL.numpy.Convert(pal.ncolors, pal, colors)
>
> Then again, we may prefer more specific array building functions.
>     palette_array = SDL.numeric.PaletteArray(mysurf.format.palette)
>     pixel_array = SDL.numeric.PixelsArray(mysurf)
>   

I'd considered this, but it winds up *requiring* that code be written
explicitly for the ctypes version of the library, which I'd defined (for
my project, SDL-ctypes) as not being allowable (since if you've written
the code for Numeric + PyOpenGL you always expect to get back
Numeric-array-compatible objects).

Sorry for the delay in responding to this,
Mike