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

Re: [pygame] [BUG] pygame-ctypes -- various from Phil



Anyone else here in favour of an issue tracker? ;-)



Phil Hassey wrote:

Looks like rect needs w support:

File "/usr/lib/python2.4/site-packages/pygame/rect.py", line 145, in __getattr__
raise AttributeError, name
AttributeError: w

Fixed, thanks.

pygame.mixer.init(MIX_FREQ, -16, False, 1024)
causes this error:

File "main.py", line 74, in init
pygame.mixer.init(MIX_FREQ, -16, False, 1024)
File "/usr/lib/python2.4/site-packages/pygame/mixer.py", line 174, in init
__PYGAMEinit__(frequency, size, stereo, buffer)
File "/usr/lib/python2.4/site-packages/pygame/mixer.py", line 95, in __PYGAMEinit__
Mix_OpenAudio(frequency, size, stereo, buffer)
File "/usr/lib/python2.4/site-packages/SDL/dll.py", line 195, in _f
raise SDL.error.SDL_Exception, SDL.error.SDL_GetError()
SDL.error.SDL_Exception: 1 (mono) and 2 (stereo) channels supported

Fixed, thanks.

svn co svn://www.imitationpickles.org/pyweek2/trunk zanthor

Your SVN repo has no anonymous access. Using http://www.imitationpickles.org/pyweek2/zanthor.tgz instead.


There is a race condition intro.py:86 causing the intro to crash intermittently on my machine; workaround by adding "cur = data[0]" before the loop.

1. Some alpha blitting issues in the pre-menu intro, it seems alpha=0 is getting switched with alpha=255

Fixed, thanks.

2. On the main menu, the dancing zanthor's transform.rotated surfaces aren't getting alpha for the background, they are getting black.

Fixed, thanks.

After the menu screens, the game doesn't work properly at all with Pygame-ctypes: crashes for cities 1, 3 and 4 (left to right along the bottom), and city 2 is "conquered" almost immediately after starting, and the sprites look quite wrong. I'll look into this later this week, unless you can track down a more specific problem sooner.

Looks like no default font got installed...

File "/home/phil/code/tronbot/view.py", line 107, in stats_paint
fnt = pygame.font.Font(None,h)
File "/usr/lib/python2.4/site-packages/pygame/font.py", line 125, in __init__
file = pygame.pkgdata.getResource(_font_defaultname)
File "/usr/lib/python2.4/site-packages/pygame/pkgdata.py", line 66, in getResource
return file(os.path.normpath(path), 'rb')
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.4/site-packages/pygame/freesansbold.ttf'

I can't replicate this.

It appears that setting the palette makes pygame-ctypes mad:

File "wireworld.py", line 25, in init
pygame.display.set_palette([(0x00,0x00,0x00),(0x00,0x00,0xaa),(0x55,0xff,0xff),(0x55,0x55,0xff)])
File "/usr/lib/python2.4/site-packages/pygame/display.py", line 700, in set_palette
colors = [SDL_Color(r, g, b) for r, g, b in palette[:length]]
NameError: global name 'length' is not defined

Not mad, just unhappy :-). Fixed.

svn co svn://www.imitationpickles.org/chestiva/trunk chestival

Using svn://www.imitationpickles.org/chestival/trunk instead...

1. When watching the intro at the end a voice says "Welcome to the Hairy Chestival" -- but with pygame-ctypes the voice sample is jittery sounding -- the voice says half a syllable and then stops then starts, etc..

Can't replicate; probably just performance related.

2. On the main menu, there is a line below Quit that is a black box. I don't think that was there with normal pygame. Looks like a space is getting rendered by the font code or something...

Fixed, thanks.

It appears that the flags going into convert() are None instead of 0...

File "flames.py", line 12, in __init__
self.tmp1 = pygame.Surface((w,h+16)).convert(8)
File "/usr/lib/python2.4/site-packages/pygame/surface.py", line 253, in convert
if flags & SDL_SRCALPHA:
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'

Fixed, thanks.


pygame-ctypes just sort of hangs. I'm not sure what is going on, but my guess is that it isn't working because I'm passing some pygame.Surface's to some custom C code that I made. I use some of the macros in pygame.h to decode the structures into SDL_Surfaces in my code ...


I suspect this is one area where pygame-ctypes won't be compatible with pygame. What changes would I have to make to my code to get it to work with pygame-ctypes?

If you call your C code with ctypes, set its argtypes to [POINTER(SDL_Surface)] and give it mysurface._surf (where mysurface is a pygame surface).


If you don't want to use ctypes to call your function, and just want a raw address, use something like pointer(mysurface._surf).value, which will give you the address of the SDL_Surface. (import * from ctypes and SDL for these names).

svn co svn://www.imitationpickles.org/rustic/trunk rustic

1. You'll notice that it takes forever to start and moving between menu items takes a while. I think this is because of my font code which uses get_at and set_at

It's mostly the blit in tilefont:TileFont.render, which is RGBA to RGBA. If you have Numeric or similar it will use that, otherwise it's a painful Python loop. The Numeric code is not yet optimised, it should use in-place operations. For a quick fix, prerender these text strings in startup.


(The actual games crash pygame-ctypes, but I think those issues are related to some of my other bug reports...)

nibbles: needs TGA support, not yet implemented.
The others are segfaulting in SDL_mixer, this will take some time to track down.


Thanks for the comprehensive testing so far.  These fixes are in r941.

Alex.