Kamilche wrote:
Lenard Lindstrom wrote:
Kamilche wrote:
Well, ctypes isn't as hard as I had feared. I've got an example
running that blits some simple boxes and pictures to the screen. I
must admit, getting it going did make use of my knowledge of the C
programming language, tho.
I couldn't use pygame ctypes, because most of the examples were
broken, and I just didn't want to figure out why. Instead, I wrote a
module to interface to SDL directly, using the ctypes feature of
Python 2.5. I was happily surprised to discover that SDL was just a
single DLL!
I'm looking forward to getting into it more, and eliminating the
installation intricacies and dependency on Pygame. If anyone's
interested, I can post the example I've made when I get back home
tonight.
I made a Windows installer available for Python 2.5 and Pygame 1.8rc3
available in October. It is close to the SVN but lacks Numpy support.
Is is available here:
http://www3.telus.net/len_l/pygame-1.8.0rc3.win32-py2.5.exe
Documentation is here:
http://www3.telus.net/len_l/pygame-1.8-docs.zip
Hope this helps.
Thanks, I'll check it out. Is this documented on the pygame website
anywhere, and I just missed it?
No, it was not on the website. I built it myself and announced it on
this list.
I got the ctypes SDL version of my program humming along. I was happy
as a clam until I tried to composite two RGBA pictures with per-pixel
alpha. What's up with that? :-( Pygame was apparently holding my hand
there, and I didn't know it until it got yanked away.
Are there many other tripups like that, where Pygame had to
reimplement something SDL was doing poorly? If it was just the
RGBA-RGBA compositing, it seems like a single C DLL would suffice, but
I don't want to get into that if there's more bombs waiting to explode.
The RGBA to RGBA blit is implemented in Pygame.
Also - I was trying to make DLL's for Python in the past, and
discovered the gnarly 'must have the same compiler Python was compiled
with' error. Is that gone with Python 2.5?
Python 2.5 still wants the 2003 toolkit. I use MinGW, which distutils
accepts without complaint. It can link to msvcr71.dll, though that takes
some minor reconfiguring. There is a Pygame wiki page on building with
MinGW.
Basically - if I go to the effort of making a vanilla C DLL, will it
be callable from Python ctypes even though it was compiled with a
different compiler? And will this C DLL work on all platforms, or will
I have to recompile it for each platform and call different DLL's
based on endianness? How do I make a PYD file?
On Windows ctypes uses Visual C as the model. Any compiler that makes VC
callable functions, such as MinGW, can be used. Or the standard calling
convention. And a DLL can be called from any Python version supporting
ctypes. Other operating systems use other kinds of dynamic libraries so
need separate compilation.
And will there be an afterlife when I die, or do old coders just fade
away? :-D
Theology according to Python: reference counts, heaps, and reincarnation
via constructors. Or would you prefer the ReBoot version: The User,
Games, and nulls.
--
Lenard Lindstrom
<[EMAIL PROTECTED]>