βοΈπ«ππ‘ππ ππ«πππ©πͺππ ππ‘πͺ
`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`](https://github.com/pygame-community/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, novialriptide, 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](https://pyga.me/docs/ref/geometry.html) 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.greyscale` through 2421 and 2432. **Expected speedup**: 7x for ARM/old x86 computers. 11x for x86 computers that support AVX2.
* itzpr3d4t0r worked on speeding `Surface.fill` when 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.smoothscale` in 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](https://pyga.me/docs/ref/window.html) for the current progress.
* Matiiss added the `[min|max]imum_size` properties in 2364
* novialriptide 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_surface` and `flip` methods and deprecating `from_display_module`. 2350, 2575, 2577, 2624.
* yunline added some unit tests in 2230
* yunline did a `grab` API rework in 2379 and 2520
* yunline added `mouse_rect` in 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.Window` in 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_to` by Matiiss in 2165
* `math.lerp` and `math.smoothstep` by robertpfeiffer in 2254
* `mixer.Channel.id` by oddbookworm in 2369
* `image.load_sized_svg` (scale as vector before loading into Surface) by ankith26 in 2620
* `mouse.[get|set]_relative_mode` by yunline in 2076
* `system.get_power_state` (battery info!) by yunline in 2257
* `display.message_box` (for alerts) by yunline in 2427
Updated API
* yunline improved subpixel rendering (float coordinates) for `_sdl2.video.Texture` and `_sdl2.video.Renderer` in 2039
* yunline added support for `int`/`str` color values in `_sdl2.video` module in 2400
* gresm added and improved support for subclassing `mixer.Sound` and `mixer.Channel` in 2590
* oddbookworm added keyword argument support to `Rect.collidedict[all]` in 2309
* oddbookworm did some changes to allow `clamp_magnitude`ing of the zero vector when possible in 2598
* Starbuck5 updated our build to use SDL_image 2.8.0, which adds support for `QOI` images, in 2595.
Removals and deprecations
* MightyJosip and MyreMylar removed deprecated `blend` argument from `draw.aaline[s]` in 2506 and 2550 respectively.
* MyreMylar removed the cythonised `_sprite` module in 2546. For now, a compat shim is provided, but its usage is deprecated.
* zoldalma999 deprecated the `depth` argument of `display.set_mode` in 2490
* Starbuck5 deprecated the old backends of `transform.smoothscale` in 2583
Performance enchancements
*In addition to those mentioned above that are SIMD-related*
* Starbuck5 optimized vector argument parsing in 2443, so `Vector` methods that operate on another `Vector` (like `move_towards`) are now ~10% faster.
* itzpr3d4t0r made many `[F]Rect` methods implement the FASTCALL convention in 2043, 2563 and 2570. All the updated functions should now work faster!
* Matiiss and itzpr3d4t0r optimized hadling of `[F]Rect` arguments 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_loop` in 2466
* Damus666 did some WASM related fixes in `display`, `math` and `color` submodules 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.rotozoom` in 2491
* yunline fix a segfault in the `update` method of `_sdl2.video.Texture` in 2553
* ankith26 fix file-like `close` not called in `freetype.Font` in 2606
* Temmie3754 fixed incorrectly drawn edges in `draw.polygon` in 2131
* Temmie3754 fixed `gfxdraw.bezier` for when there are a lot of points in 2503
* MyreMylar fixed a segfault when passing empty `StringIO`/`File` objects to `Font` in 2548
* MyreMylar fixed RLE related issues in the `transform` module in 2535
* MyreMylar prevented an unnecessary warning from being raised when using `SysFont` and the default font in 2543
* Starbuck5 implemented a fix for windows webcams that don't report framerate crashing `pygame.camera` in 2574
* Starbuck5 fixed `image.get_sdl_image_version` incorrectly handling the `linked` argument in 2597
Test and examples related improvements
* dr0id corrected a typo in `Rect` test methods in 2359
* Matiiss added a `mixer` test skip because it randomly fails on Linux in 2438
* zoldalma999 removed `test` tests in 2475
* JorasOliveira added tests to `Surface.get_(f)rect` in 2492
* gresm added more multiline examples in 2588
* KentAugust added multiplayer joystick example in 2524
* bilhox updated `video` example to use the new `pygame.display.message_box` in 2572
* llindstrom updated the `go_over_there` example 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 `overlay` module in 2411
* bilhox updated the French README in 2228
* oddbookworm did some minor `sprite` doc fixes in 2423
* sweatshirtwearingviper corrected a `sprite` documentation error in 2442
* Carbon32 added a Spanish translation of the README file in 2430
* novialriptide corrected casing for macOS in 2538
* Notenlish fixed caution visual bug for dark theme in 2418
* JiffyRob added docs for `devicename` parameter in `mixer.init` in 2525
* JorasOliveira clarified `event.custom_type` docs in 2527
* ZeroWave022 added typing support for `sprite.collide_mask` as `collided` argument in `sprite.spritecollide` in 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 `scrap` docs to highlight non-deprecated functions in 2515
* MyreMylar added some missing `versionadded` tags in `mouse` in 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_EVENTS` in 2511, 2484.
* MyreMylar removed an unused param from `Surface.convert_alpha` docs in 2486
Other general updates
* Matiiss improved `Surface.fill` error 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__.py` in 2507
* yunline removed unneeded SDL version checks in 2372
* Matiiss made minor improvements to `Window.size` and `Window.position` C code in 2367
* Matiiss fixed linter failing due to new `clang-format` version in 2461
* MyreMylar ran `clang-format` on the vendored contents of `SDL_gfx/` in 2508
* MyreMylar removed usage of deprecated `Thread.setDaemon` in 2559
* ankith26 fixed compiler warnings in event, camera and display in 2567
* ankith26 made windows `_camera` compile only on MSVC in 2585
* ankith26 updated `pygame.version` to not be an autogen file in 2537
* ankith26 fixed a pypy fail by calling `PyObject_GetBuffer` directly 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_ResizeEventWatch` in 2487
* Starbuck5 added usage of `RAISE` macro 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**: https://github.com/pygame-community/pygame-ce/compare/2.3.2...2.4.0