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

[pygame] the changes



well, all snugged into CVS are just about every change discussed
recently. quickly looking at the WhatsNew file, you can see:

Nov 15, 2000
 BREAK: Moved pygame.music to a member of pygame.mixer
 BREAK: Surface.blit takes a source rectangle instead of pos, size
 BUG: pygame.display.set_clip() correctly accepts rectstyle arg
 Added Surface.get_flags() and Surface.get_pitch()
 Added set_cursor and get_cursor to pygame.mouse
 New module, pygame.cursors, contains sample cursors


all the documentation and examples have been updated for all
these changes. here's a bit more info for those of you who
need to go back and 'relearn' what you have learned ;]

the music module is now embedded into the mixer module.
technically, it is handled as a separate module, but you
don't need to worry about that. it is imported and setup
for you all automatically through the mixer module.
if you have a large chunk of code that depends on how the
music module used to be, you can make some magic changes
when importing it all.
    >>> import pygame, pygame.mixer
    >>> pygame.music = pygame.mixer.music
that will get you all back the the way things were, like
nothing had ever changed. only now there are none of the 
"init" related functions in the music module.

Note, you'll need to change your "Setup" file used by 
distutils. as you'll see in "Setup.in", music's new module
name is mixer_music. this is to help prevent confusion.
not that until you remove your "build" directory and the
music.pyd/.so from $PYTHONHOME/pygame, the old music module
will still be around. i suggest you get rid of the old one.

The blit routine now uses a rectstyle object as the last
argument when specifying a subsection of the source image
to blit. this is an easy change. you can do it without even
thinking by putting parenthesis around the last two arguments
on blits that were using all the arguments.
    >>> dest.blit(src, pos, srcpos, srcsize)
becomes
    >>> dest.blit(src, pos, (srcpos, srcsize))
of course, there if you already have Rect objects, you can
just use that instead of splitting into two arguments, this
is just the 'no-thinker' method of updating old blit calls.

The other changes are pretty minor. The only one needing any
extra info is the new cursor routines in pygame.mouse.
the function pygame.mouse.set_cursor() takes four arguments
specifying the cursor size, hotspot, xor-data-mask, and
finally the bitwise-and-mask. you can also call get_cursor()
to retrieve all this information for the current cursor.
there is a new python module named pygame.cursors that has
a few sample cursors in it. sadly samples are only the default
pygame black arrow and a broken diamond cursor.
the "fonty" example has been updated to change the cursor.

(the diamond is broken because XBM and pygame cursor bits
are opposite endian. (that's right, bit-swapped) :[)

anyways, for those of you needing to modify the cursor, you
now have an easy method to change the cursor in pygame.
(the only hard part is "creating" the cursors, heh. soon there
will be a nice converter to handle pretty formatted strings,
along with some good working cursors in the cursor module)

you can grab this all now by updating from cvs. all the other
issues with documentation and the website are fixed now too.
(i believe)

there is just one last issue holding us back from 0.3, i'll
discuss that in the 'next' message so the message threads can
be a little coherent. (as if this email wasn't big enough)

Hope this helps everyone out. The breaking changes are never
fun, but i unless you do a ton of music calls or are using the
blit function with all arguments often, it should just be a
couple lines.

Use it and abuse it.
Pete Shinners


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