🌼🌸 python3 -m pip install pygame==2.0.1
The Age Of Aquarius, the northern Winter Solstice, and the southern Summer Solstice bring us... a new pygame to play with :)
This is a bug fix release, with a bunch of features and optimizations thrown in for good measure. Thank you to the people reporting issues related to pygame 1 compatibility. Some of them will take a bit longer to discuss, work through, and find solutions. We say goodbye to Travis the CI that served us well. We said goodbye to the pygame discord that had grown too big, only for a few more to have sprouted up in its place. We said hello to the patreon.com/pygame and we took a breather for a little bit.
Enough bla bla bla... what's new?
Firstly, a few backwards compatibility fixes have been made.
Dan Lawrence @MyreMylar worked some more on the alpha blitter so it's more compatible.
René Dudfield (@illume) worked on making some old audio driver and video driver names that had been renamed work in backwards compatible env vars, SDL_VIDEODRIVER=windib, SDL_AUDIODRIVER=pulse or dsound #2292
Ankith (@ankith26) did a major event refactor in #2357 #2404 #2416 and #2398 This not only cleaned up the event processing code, but fixed a bunch of issues an introduced some new features making event processing more comfy along the way.
Here's a graph to treat your eyes, on an event benchmark where getting lots of events has been sped up a lot. As you can see, its a 7 times speed up. There are also less peaks in there, due to less thread locking on the event queue and using batching API calls.
Pierre Sassoulas (@Pierre-Sassoulas) has been working on some code quality fixes using the pylint tool (and apart from these merged PRs working on setting up other code quality tools and a pre-commit checker).
@zoldalma999 (who recently joined the pygame team on github after contributing several high quality patches to pygame) worked on a proposal by David Lönnhager (@dlon) to add Color.update and Rect.update #2277
Vectors already have an update() method. Now Color, and Rect do too :)
>>> c = pygame.Color(0, 0, 0) >>> c2 = pygame.Color(1, 2, 3, 4) >>> c (0, 0, 0, 255) >>> c.update(c2) >>> c (1, 2, 3, 4) >>> rect = pygame.Rect(0, 0, 1, 1) >>> rect.update(1, 2, 3, 4) >>> rect <rect(1, 2, 3, 4)> >>> rect = pygame.Rect(0, 0, 1, 1) >>> rect2 = pygame.Rect(1, 2, 3, 4) >>> rect.update(rect2) >>> rect <rect(1, 2, 3, 4)>
@zoldalma999 also worked on:
René Dudfield (@illume) was hacking on some things like these:
libsdl is a library pygame is built on. It had a new release after almost 9 months of development. The 2.0.14 release notes detail things a little bit. More than 9 months worth of effort is a bit much to explain.
There's been a number of bugs fixed we reported in the pygame 2 series. One of which was pygame.display.update() updating the whole screen on windows. So, now 'dirty rect drawing' is faster again on windows. From the list you'll notice a lot of work went into joystick and game controller improvements. Including support for more than 4 xbox controllers at once on windows. But linux, android, mac, and even freebsd got joystick improvements. On linux the Kernel Mode Setting (KMSDRM) video driver was improved a lot. For retro computing fans, the OS2 port got a lot of love. Lots of portability things were improved, like fixing compilation for M1 CPUs, improving the build system. Raspberry Pi support has been improved, as have most video drivers for other platforms.
Victor Lopez started on an Xbox one port, and has had some success.
I can confirm Xbox One is able to run the aliens sample with joystick support, audio and sprites, it needs, however, heavy testing.
These are the relevant repositories:
pathlib is an object oriented way of doing path handling in python 3 (there's also a backport to python2). Before pygame didn't handle these objects in resource loading functions for image and sound loading. Now it does pathlib!
path = pathlib.Path('.') / "data" / "house_lo.wav" sound1 = mixer.Sound(path)
Now you can add system cursors, and color cursors out of surfaces along with the other ones you could draw with ascii art.
box = pygame.cursors.Cursor((10,10), pygame.Surface((20,20))) system = pg.cursors.Cursor(pg.SYSTEM_CURSOR_NO) pg.mouse.set_cursor(cursors[cursor_index])
This script by @dr0id made it much easier to spot the problems.
Ankith @ankith26 merged these ones in (whilst also looking at some difficult event posting issues, and cleaning up some image loading code).
@mcpalmer1980 Added experimental relative mouse motion support to video.Window in #2392 They have also been using the experimental _sdl2 features quite a lot and coming up with some good improvements and discussions on that (including a new package!).
Dan Lawrence ( @MyreMylar ) was on a coding rampage and made a number of improvements: