[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] today's update



juest keeping you up to date with the ever-changing world
of pygame. today SDL_image-1.1.0 was released. this added XPM
file support, and also fixed a crashing bug when it couldn't
determine the image type of a file.
i've updated the win32 binary pygame-dependencies.zip file
to use the new version of SDL_Image.


two semi-unremarkable commits to cvs today...

Nov 30, 2000
 UserRect module added
 all objects now have a matching type; SurfaceType, etc


the UserRect class works exactly like the python UserList, etc.
it is working really well. i tried switching the aliens "Actor"
class to be derived from UserRect instead of including a Rect
data member. this did make the code really nice, but had a
noticeable slowdown so i scrapped the change. I'm going to try
it again, hoping i just made a silly error somewhere.
anyways, it's a nice little class, but if it really turns out
to be that much slower than the Rect objects, its not going to
be worth much. what's nice is it is completely interchangeable
with real Rect objects.

while working with some code, i quickly realized there is no way
to check the type of all the new objects. in a function to know
if it was passed a Surface or a simple color tuple. I went in and
added matching "*Type" objects for all the pygame objects. now you
can code;
>>> if type(argument) is pygame.SurfaceType: print 'is surface'
>>> if type(argument) == pygame.font.FontType: print 'is font'
etc, etc.

the only gotcha is that there is no RectType in the locals module.
i'm pretty close to putting it there, but thought i'd 'wait and see'.
currently RectType is in the pygame namespace
>>> import pygame
>>> from pygame.locals import *
>>> r = Rect(1,2,3,4)
>>> if type(r) is pygame.RectType: print 'its a rect'


heh, a whole day with no breaking changes. i am thinking this
will be the first in a long streak. :]


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org