☀️🏫🎊🏡🎆🏠🕛🏫🌈🎄🏩🏪🎇🏠🎉🏡🪅
pip uninstall pygame (if previously installed, to avoid package conflicts)
pip install pygame-ce --upgrade
☀️🏫🎊🏡🎆🏠🕛🏫🌈🎄🏩🏪🎇🏠🎉🏡🪅
Happy new year! And with that, hello and welcome to yet another release of pygame-ce!
In about 4 months since the last release, this release has seen 36 contributors make over 150 pull requests and 606 commits with 81,203 line additions and 88,026 line deletions across 375 files! Wow!
The 2.4.x series drops support for Python 3.7, which has reached EOL. If you are still using this, consider upgrading to a newer Python version!
Special thanks to all our new (and returning after a while) contributors. Check out the changes!
Notable changes
🟢 A new experimental geometry submodule with a Circle class
A new submodule is making its way to pygame, how exciting!
The pygame_geometry project started with the purpose of helping users integrate special colliders more easily, by providing implementations for things like polygons, circles, lines, and raycasting. This submodule is still in early development and is very much experimental, but is set to slowly make its way into pygame-ce over the next couple of releases.
A big thanks to everyone who contributed to pygame-geometry so far: @Emc2356, @itzpr3d4t0r, @andrewhong04, @ScriptLineStudios, @avaxar, @gresm, @Matiiss, @newpaxonian, @maqa41 and @blankRiot96
Parts of the submodule were ported bit by bit in the PRs #2268, #2562, #2560, #2614, #2540, #2536, #2519 and #2545
As with all experimental submodules, do remember that things in here are subject to change, and there are a lot more things to be added! See the docs for the current progress.
🚀 More SIMD-based performance enhancements
Did you know pygame-ce uses optimized assembly? We use single instruction, multiple data (SIMD) instructions to speed up operations with lots of parallel computations. In this release, we've used this to increase performance of several transform and Surface operations (with more to come in future releases). These optimizations target Intel/AMD and ARM architectures.
- @MyreMylar added an optimized backend for
transform.greyscalethrough #2421 and #2432. Expected speedup: 7x for ARM/old x86 computers. 11x for x86 computers that support AVX2. - @itzpr3d4t0r worked on speeding
Surface.fillwhen used with blend flags in #2566, #2382 and #2565. Expected speedup: Ridiculously faster, like 50-100x faster - @Starbuck5 added a new optimized backend for
transform.smoothscalein #2473 and #2544. Expected speedup: 15% faster on x86, 35% faster on ARM.
🪟 Improvements to the experimental Window class
A lot of nice work went behind the experimental Window class in this release. The Window class enables controlling multiple windows, and enables cool new windowing features over the pygame.display API. This is important because we hope the Window API exits experimental status soon! See the docs for the current progress.
- @Matiiss added the
[min|max]imum_sizeproperties in #2364 - @andrewhong04 fixed a segmentation fault when destroying window in #2530
- @yunline and @Starbuck5 created a new way to manage display surfaces with Window, adding the
get_surfaceandflipmethods and deprecatingfrom_display_module. #2350, #2575, #2577, #2624. - @yunline added some unit tests in #2230
- @yunline did a
grabAPI rework in #2379 and #2520 - @yunline added
mouse_rectin #2564 - @Starbuck5 worked to improve the documentation and remove extraneous/questionable bits of the API. #2617, #2618, #2627.
- @Starbuck5 made the Window class available as
pygame.Windowin #2604 and #2607.
API Changes
New API
key.get_just_[pressed|released](check key status without event loop) by @ScriptLineStudios in #1912[F]Rect.move_toby @Matiiss in #2165math.lerpandmath.smoothstepby @robertpfeiffer in #2254mixer.Channel.idby @oddbookworm in #2369image.load_sized_svg(scale as vector before loading into Surface) by @ankith26 in #2620mouse.[get|set]_relative_modeby @yunline in #2076system.get_power_state(battery info!) by @yunline in #2257display.message_box(for alerts) by @yunline in #2427
Updated API
- @yunline improved subpixel rendering (float coordinates) for
_sdl2.video.Textureand_sdl2.video.Rendererin #2039 - @yunline added support for
int/strcolor values in_sdl2.videomodule in #2400 - @gresm added and improved support for subclassing
mixer.Soundandmixer.Channelin #2590 - @oddbookworm added keyword argument support to
Rect.collidedict[all]in #2309 - @oddbookworm did some changes to allow
clamp_magnitudeing of the zero vector when possible in #2598 - @Starbuck5 updated our build to use SDL_image 2.8.0, which adds support for
QOIimages, in #2595.
Removals and deprecations
- @MightyJosip and @MyreMylar removed deprecated
blendargument fromdraw.aaline[s]in #2506 and #2550 respectively. - @MyreMylar removed the cythonised
_spritemodule in #2546. For now, a compat shim is provided, but its usage is deprecated. - @zoldalma999 deprecated the
depthargument ofdisplay.set_modein #2490 - @Starbuck5 deprecated the old backends of
transform.smoothscalein #2583
Performance enchancements
In addition to those mentioned above that are SIMD-related
- @Starbuck5 optimized vector argument parsing in #2443, so
Vectormethods that operate on anotherVector(likemove_towards) are now ~10% faster. - @itzpr3d4t0r made many
[F]Rectmethods implement the FASTCALL convention in #2043, #2563 and #2570. All the updated functions should now work faster! - @Matiiss and @itzpr3d4t0r optimized hadling of
[F]Rectarguments in #2041 and #2465.
Bug fixes
- @dr0id added checks to disable font API usage when the subsystem is not initialized in #2371
- @oddbookworm fixed an underflow issue in
tick_busy_loopin #2466 - @Damus666 did some WASM related fixes in
display,mathandcolorsubmodules in #2480 and #2482 (by adding required PyObject *_null parameter to functions marked with METH_NOARGS) - @pmp-p fixed a WASM loader incorrect target issue in #2586
- A team of new contributors: @igordsm, @JorasOliveira, @Antonioarf, @jpgianfaldoni, @caioesr, @cicerotcv and @nataliaqmc fixed a colorkey issue in
transform.rotozoomin #2491 - @yunline fix a segfault in the
updatemethod of_sdl2.video.Texturein #2553 - @ankith26 fix file-like
closenot called infreetype.Fontin #2606 - @Temmie3754 fixed incorrectly drawn edges in
draw.polygonin #2131 - @Temmie3754 fixed
gfxdraw.bezierfor when there are a lot of points in #2503 - @MyreMylar fixed a segfault when passing empty
StringIO/Fileobjects toFontin #2548 - @MyreMylar fixed RLE related issues in the
transformmodule in #2535 - @MyreMylar prevented an unnecessary warning from being raised when using
SysFontand the default font in #2543 - @Starbuck5 implemented a fix for windows webcams that don't report framerate crashing
pygame.camerain #2574 - @Starbuck5 fixed
image.get_sdl_image_versionincorrectly handling thelinkedargument in #2597
Test and examples related improvements
- @dr0id corrected a typo in
Recttest methods in #2359 - @Matiiss added a
mixertest skip because it randomly fails on Linux in #2438 - @zoldalma999 removed
testtests in #2475 - @JorasOliveira added tests to
Surface.get_(f)rectin #2492 - @gresm added more multiline examples in #2588
- @KentAugust added multiplayer joystick example in #2524
- @bilhox updated
videoexample to use the newpygame.display.message_boxin #2572 - @llindstrom updated the
go_over_thereexample for Python 3.12 in #2521 - @ankith26 made some freetype tests run on CI and fixed a minor test fail in #2370
- @ankith26 added tests for PBM, LBM and XCF images, and also updated some docs in #2608
Docs and typing related enhancements
- @itzpr3d4t0r improved
Surface.blit[s]docs in #2262 and #2263 - @zoldalma999 remove mentions of
overlaymodule in #2411 - @bilhox updated the French README in #2228
- @oddbookworm did some minor
spritedoc fixes in #2423 - @sweatshirtwearingviper corrected a
spritedocumentation error in #2442 - @Carbon32 added a Spanish translation of the README file in #2430
- @andrewhong04 corrected casing for macOS in #2538
- @Notenlish fixed caution visual bug for dark theme in #2418
- @JiffyRob added docs for
devicenameparameter inmixer.initin #2525 - @JorasOliveira clarified
event.custom_typedocs in #2527 - @ZeroWave022 added typing support for
sprite.collide_maskascollidedargument insprite.spritecollidein #2569 - @Starbuck5 removed some obsolete information in #2459 and #2499
- @Matiiss added positional-only parameter notation (
/in function signature) in #2457. This removes ambiguity from the docs about whether a function supports keyword arguments or not. - @Matiiss edited
scrapdocs to highlight non-deprecated functions in #2515 - @MyreMylar added some missing
versionaddedtags inmousein #2573 - @MyreMylar added a Premultiplied Alpha tutorial in #2531
- @MyreMylar de-emphasise passing a list of rectangles to update in #2532
- @MyreMylar removed 'responsive' tables from docs CSS in #2509
- @MyreMylar added docs for windows DPI awareness hint and docs/tests for
SDL_MOUSE_TOUCH_EVENTSin #2511, #2484. - @MyreMylar removed an unused param from
Surface.convert_alphadocs in #2486
Other general updates
- @Matiiss improved
Surface.fillerror message for invalid blend flags in #2434 - @ankith26 dropped Python 3.7 support in #2493
- @MyreMylar reduced usage of "dummy" in codebase to minimum in #2547
- @MyreMylar stripped the leading
SDL_from the pixel format name in #2477
Code quality and robustness
- @Julian-O remove spurious comment in base
__init__.pyin #2507 - @yunline removed unneeded SDL version checks in #2372
- @Matiiss made minor improvements to
Window.sizeandWindow.positionC code in #2367 - @Matiiss fixed linter failing due to new
clang-formatversion in #2461 - @MyreMylar ran
clang-formaton the vendored contents ofSDL_gfx/in #2508 - @MyreMylar removed usage of deprecated
Thread.setDaemonin #2559 - @ankith26 fixed compiler warnings in event, camera and display in #2567
- @ankith26 made windows
_cameracompile only on MSVC in #2585 - @ankith26 updated
pygame.versionto not be an autogen file in #2537 - @ankith26 fixed a pypy fail by calling
PyObject_GetBufferdirectly in base C code in #2639 - @Starbuck5 started work on SDL3 support by incrementally patching modules to get them to compile in the PRs #2437, #2439, #2440, #2481, #2483, #2500, #2501, #2502
- @Starbuck5 removed redundant checks in
pg_ResizeEventWatchin #2487 - @Starbuck5 added usage of
RAISEmacro when appropriate in #2444
CI and dependency related updates
- @oddbookworm capped the sphinx version under 7.2.0 in #2407
- @MyreMylar fixed grub-efi-amd64-signed installation failures on Ubuntu 20.04 CI builds in #2504
- @zoldalma999 and @Starbuck5 removed old CI files in #2479 and #2460
- @Starbuck5 managed versions of our SDL dependencies, raising our minimum build requirements and updating to SDL 2.28.5 as well as a custom build of SDL_image 2.8.0. #2464, #2584, #2580, #2595, #2596, #2474
- @ankith26 kept improving our Mac and Linux dependency systems, and keeping our subdependencies up to date. One big win of this work is a 1.4 mb reduction in the size of the Linux wheels, achieved by making mpg123, fluidsynth and sndfile not link directly to lower-level audio playback libs! #2470, #2513, #2549, #2471
New (& returning after a time) Contributors
- @sweatshirtwearingviper made their first contribution in #2442
- @Carbon32 made their first contribution in #2430
- @Damus666 made their first contribution in #2480
- @Julian-O made their first contribution in #2507
- @llindstrom a pygame contributor of long standing, made their first contribution to pygame-ce #2521
- @JorasOliveira, @igordsm, @Antonioarf, @jpgianfaldoni, @caioesr, @cicerotcv and @nataliaqmc made their first contributions in #2491
- @MightyJosip a pygame contributor of long standing, made their first contribution to pygame-ce in #2550
- @ZeroWave022 made their first contribution in #2569
- @KentAugust made their first contribution in #2524
- @maqa41 made their first contribution in pygame geometry
- @newpaxonian made their first contribution in pygame geometry
Thanks all
A hearty thank you to everyone involved! In addition to PR makers, we are thank the community at large. This includes issue reporters, PR reviewers, tutorial makers, admins/mods/helpers on various online forums, people who make helper libraries, and last but certainly not least, all our users including you: the person reading these notes!
Apologies in advance if we've made a mistake in these notes, do not hesitate to get in touch with us to get a correction made.
Cya, and have fun!
Full Changelog: 2.3.2...2.4.0