💽🏴🍋⚫📀🖤💽🏴⚫📀🖤💽🏴🌞⚫📀🖤
⚫ pip install pygame-ce
📀👤💽🏴⚫📀🖤💽🏴🍋⚫📀🖤💽🏴🍋🔌
(pip uninstall pygame
first to avoid contention)
Hello! This is the first release of pygame-ce
-- pygame community edition, a pygame fork. See our reddit announcement for more of an explanation of the fork's goals and reason for existing.
The entirety of the code changes in this release were developed under the original pygame name. Most of these changes were actually developed by the contributors making this fork!
These changes represent the work on the pygame main branch between December of 2021 and October of 2022. (This release was supposed to happen back in October 2022 to add 3.11 support, but that didn't happen).
This changelog reflects the difference between pygame 2.1.2 and pygame-ce 2.1.3, with a few caveats. After these notes were written and the release was prepped, a couple memory leaks were discovered, and those patches have been added. Additionally, warning, font rendering doesn't work on macOS <= 11.0 in this release. We're aware of the problem and have a potential (if not ideal) fix drafted.
Release notes of 2.1.3, extremely long because of the long timescale covered:
Highlights
pygame on the Web
pygame now has source code support for WASM (web assembly)! @pmp-p is driving most of the work behind this, you can check their github profile to see a few pygame apps in action on the browser!
This is still a work-in-progress - more changes and fixes need doing before this will be a smooth experience. Existing pygame applications need a few minor changes to work on browsers.
See https://github.com/pygame-web/pygbag for more information.
Thanks to pmp-p for making this possible on the pygame end (pygame/pygame#3080, pygame/pygame#3104, pygame/pygame#3105, pygame/pygame#3106, pygame/pygame#3108, pygame/pygame#3191, pygame/pygame#3185, pygame/pygame#3115, pygame/pygame#3225, pygame/pygame#3246, pygame/pygame#3247, pygame/pygame#3349, pygame/pygame#3304), and thanks to the CPython team for making CPython 3.11 compile nicely on WASM.
Faster blitting
@MyreMylar has been hard at work to make some special flags for Surface.blit
faster using SIMD instructions, and the results can be more than 10x faster on supported hardware! (pygame/pygame#2988, pygame/pygame#3136, pygame/pygame#3170, pygame/pygame#3181) @Starbuck5 followed in his footsteps improving blit blend mode efficiency slightly in pygame/pygame#3294 and getting a 15-20% boost for simple alpha blits in pygame/pygame#3378. There are more blitter improvements in the pipeline and we expect more boosts to alpha blending in 2.1.4.
Enhancements
A lot of nice additions and enhancements. There is some new API in this release, which currently have the experimental status. This release also has some performance enhancements (some of those are from updated dependencies, the performance changes on the pygame end are listed throughout the notes and not in this section)
New contributor @ThanhChinhBK made it possible to save surfaces with palettes as indexed 8P PNG in pygame/pygame#3028
New contributor @mariospapaz added font.get_sdl_ttf_version
to check the underlying SDL_ttf
library version in pygame/pygame#3095
New contributor @Emc2356 added pygame.image.(to|from)bytes
(the same as (to|from)string but appropriately named) in pygame/pygame#3321
New contributor @rlatowicz added support for the BGRA
format for image functions in pygame/pygame#3338 and pygame/pygame#3342. This should be helpul for pygame interoperability with pycairo!
New contributor @JamesC01 added math.clamp(val, min, max)
in pygame/pygame#3326 and pygame/pygame#3361
Vectors have been receiving some nice polish thanks to the efforts of @novialriptide, who added move_towards()
in pygame/pygame#2929 and clamp_magnitude
in pygame/pygame#2990 and pygame/pygame#3133
@Starbuck5 added transform.scale_by
and transform.smoothscale_by
functions in pygame/pygame#2723
@dr0id added the parameter consider_alpha
to transform.average_color
to to remove black artifacts if alpha is present in pygame/pygame#2968. They also added a new rect method Rect.collidelistall
in pygame/pygame#3026 and pygame/pygame#2989
@MightyJosip added a strikethrough option to Font
in pygame/pygame#2991
- Added
precise_x
andprecise_y
fields toMOUSEWHEEL
events and also added some more pygame events in pygame/pygame#2953. - Made
Rect
andColor
supportcollections.abc.Container
in pygame/pygame#3066 - Added
use_compat
topygame.key.name
, fixedkey_code
compat issues in pygame/pygame#3312
New contributor @itzpr3d4t0r cleaned up / optimized functions in the draw
, math
, and transform
, and rect
modules, resulting in some speedups for certain tasks. Check the PRs if you're interested. pygame/pygame#3300, pygame/pygame#3314, pygame/pygame#3335, pygame/pygame#3319, pygame/pygame#3401
@avaxar changed _sdl2.video.Image.flipX
and .flipY
to use snakecase in pygame/pygame#2978
Bug Fixes
This release comes with many bug fixes on the pygame side, but there should also be improvements due to bundling newer shinier versions of our dependencies.
New contributor @SnoopJ added checks to fail early if there are SDL version incompatibilities in pygame/pygame#2661
New contributor @Matiiss fixed windows version parsing in camera that errored on windows versions like 8.1 in pygame/pygame#3158
New contributor @ryanking13 fixed wasm build when no PREFIX variable is defined in pygame/pygame#3280
New contributor @PurityLake
- Fixed window not staying centered on second call of
display.set_mode
in pygame/pygame#3172 - Fixed segault in subclass of
Sound
in pygame/pygame#3492
- Fixed pygame Vector subclassing in pygame/pygame#3088. Now inherited methods return objects of the correct subtype.
- Added Windows user fonts handling for
pygame.font.match_font()
in pygame/pygame#3184
- Fixed a serious performance regression of
draw.polygon
in pygame/pygame#3141 - Fixed
pkgdata
import so that pygame continues to work with PyInstaller in pygame/pygame#3082 - Not all surfaces started of with an opaque black background on MacOS, this was fixed in pygame/pygame#2973
- Fixed DLL loading problems on Windows Store Python installations in pygame/pygame#3196
- Made textinput show a candidate list in pygame/pygame#3244
- Fixed
Surface.set_palette
to be usable without an initialized display in pygame/pygame#3259
- Fixed UCS_4 UCS4 typo, incorrect color methods export and display.c error handling bugs in pygame/pygame#2987
- Fixed a segfault in resource loading functions such as
pygame.image.load
in pygame/pygame#3089 - Added a mutex to guard multithreaded functions in
pygame.event
and fixed allocation issues due to GIL in pygame/pygame#3177 font.get_fonts
was returning a listNone
in some cases, this has now been fixed in pygame/pygame#3159. Now sysfont code also warns when there are underlying internal issues.- Made sure all functions in
pygame.camera
are defined at all times regardless init state and fixed a few more bugs around here in pygame/pygame#2961 - Music load fails could trigger wrong errors, this was fixed to only raise
pygame.error
in pygame/pygame#3148 - Internal function
pgBuffer_Release
now retains previously set errors in pygame/pygame#3127 - Internal function
v4l2_read_frame
could raise python exceptions when it should not, fixed in pygame/pygame#3052 - Fixed misnamed
APPMOUSEFOCUS
constand naming and updated the values in pygame/pygame#3043 - Fixed
Controller.rumble
returning wrong bool on error in pygame/pygame#3248 - Vendor in SDL PNG save function, fix new 2.1.3 regression in pygame/pygame#3376
- Fixed an edge case bug in
Vector.move_towards
, add more tests in pygame/pygame#3400 - Fixed segfault (due to incref issue) in
PixelArray
context manager API in pygame/pygame#3414 - Delete rect subscripts should error not segfault in pygame/pygame#3440
- Made sure
display.set_mode
always returns a cleared window in pygame/pygame#3317 - Fixed pypy rect freelist issue, unskipped tests in pygame/pygame#3452
- Fixed blitters compile error when missing SIMD in pygame/pygame#3498
@MightyJosip fixed a Vector memory leak in pygame/pygame#3236
@MyreMylar removed SIGALARM
suppression in pygame/pygame#3142
Devops, Maintenance, and Cleanups
The pygame codebase has seen a lot of devops related changes, with many contributors helping with cleanups and maintenance. These changes would have also fixed a few rare bugs and such.
New contributor @SergioArnaud fixed dependencies not being found on PowerPC in pygame/pygame#2975.
New contributors @Yvant2000 and corrected a code comment in rect.c
in pygame/pygame#3182
New contributor @GregoryMorse noticed VideoInfo
string was missing closing parenthesis and fixed this in pygame/pygame#3053
New contributor @blankRiot96 removed an old use Python 2's __nonzero__ in pygame/pygame#3194
New contributor @blankRiot96 deprecated Color.set_length
in pygame/pygame#3352
New contributor @itzpr3d4t0r ensured the CI continued to work by fixing a checksum in pygame/pygame#3329
New contributor @Vazno removed unused imports, fixed a confusing message, and improved some code in pygame/pygame#3382, pygame/pygame#3388, pygame/pygame#3397, and pygame/pygame#3392
New contributor @Matiiss replaced some truth testing with is not None
checks in sprite module in pygame/pygame#3271
New contributor @kevin-pease removed deprecated blend argument from test and docs in pygame/pygame#3281
New contributor @lebedevhhh changed f strings (sysfont.py) in pygame/pygame#3391
@robertpfeiffer made buildconfig handle -auto
flag in pygame/pygame#3157
@zoldalma999 improved clang format source file detection in pygame/pygame#3140
@zoldalma999 added __new__
and __init__
methods to some pygame classes in pygame/pygame#3001. Previously these classes had functions named after the class that did what __init__
was supposed to do. He also changed renderer names to strings in _sdl2.video.get_drivers
in pygame/pygame#3132.
@cclauss worked on linting and improving the python source code in pygame/pygame#3208, pygame/pygame#3213, pygame/pygame#3207, pygame/pygame#3212, pygame/pygame#3220, and pygame/pygame#3219
@pmp-p fixed setup.py for clang-built Python, fixed a deprecation warning, and corrected some relative imports in pygame/pygame#3381, pygame/pygame#3228, and pygame/pygame#3313
@novialriptide cleaned up some python code in pygame/pygame#2984, pygame/pygame#3013, and pygame/pygame#3016
@illume worked to update manylinux and Windows dependencies in pygame/pygame#2983, pygame/pygame#3475 and pygame/pygame#3059
@illume generated the 2.1.3 dev releases in pygame/pygame#2957, pygame/pygame#3039, pygame/pygame#3060, pygame/pygame#3471, pygame/pygame#3503 and pygame/pygame#3513
@ankith26 worked on refactoring and improving code in pygame/pygame#2952, pygame/pygame#2919, pygame/pygame#3032, pygame/pygame#3067, pygame/pygame#3041, pygame/pygame#3201, pygame/pygame#3206, pygame/pygame#3203, pygame/pygame#3295, pygame/pygame#3366, pygame/pygame#3325, pygame/pygame#3396, and pygame/pygame#3490
@ankith26 made sure the continuous integration and Mac/Linux dependencies were well in order in pygame/pygame#3188, pygame/pygame#3187, pygame/pygame#3431, pygame/pygame#3042, pygame/pygame#3347, pygame/pygame#3445, pygame/pygame#3433, and pygame/pygame#3496
@ankith26 relaxed a SDL minor version exact match check that was giving users problems on Linux in pygame/pygame#3428
@MyreMylar added tools to make it easier for us to understand and implement blitting changes in pygame/pygame#2964 and pygame/pygame#3284.
@MyreMylar also did some code formatting himself, in pygame/pygame#3137
@ankith26 and @Starbuck5 added Python 3.11 builds to CI in pygame/pygame#3484 and pygame/pygame#3486
@Starbuck5 worked on refactoring and improving code in pygame/pygame#3192, pygame/pygame#3183, pygame/pygame#3014, pygame/pygame#2911, pygame/pygame#3093, pygame/pygame#3126, pygame/pygame#3180, pygame/pygame#3216, pygame/pygame#3186, pygame/pygame#3296, pygame/pygame#3344, pygame/pygame#3364, pygame/pygame#3375, pygame/pygame#3416, pygame/pygame#3487, pygame/pygame#3239, and pygame/pygame#3272
@Starbuck5 worked to keep windows dependencies up to date in pygame/pygame#3086, pygame/pygame#3162, pygame/pygame#3193, and pygame/pygame#3287
Unit Tests and Typestubs
New contributor @JovialKnoll added a missing copy test for Vector3
in pygame/pygame#3000
New contributor @PurityLake added a unittest for fullscreen toggle in pygame/pygame#3171
New contributor @Temmie3754 relaxed strict pixel match tests in test_src_alpha_sdl2_blitter
by allowing a small delta by in pygame/pygame#3494
New contributor @SSS-Says-Snek added SysFont pygame.font.get_fonts()
verification test in pygame/pygame#3266
@novialriptide improved Rect
typehints in pygame/pygame#2969
@MyreMylar added a unit test for display.gl_set_attribute()
in pygame/pygame#3256
@MightyJosip fixed imported class typehints in pygame/pygame#2965.
- Added a unittest for
pygame.locals
in pygame/pygame#2958 - Fixed stubtest warnings, run stubtest on CI in pygame/pygame#2999 and pygame/pygame#3075
- Did some Event tests and types improvements in pygame/pygame#3063
- Did some
Sprite
typestub updates, used generics and protocols in pygame/pygame#3138 - Added
_GenericVector
to math typestubs and did some more fixes in pygame/pygame#3150 - Fixed latest stubtest issues in pygame/pygame#3332
- Fixed new mypy-0.981 fails in pygame/pygame#3470
- Fixed tests that had overshadowed names in pygame/pygame#3384
Docs and Examples
New contributor @eoghanriley fixed a typo in tests.rst
in pygame/pygame#3022
New contributor @gresm corrected some docs formatting in pygame/pygame#3122, and fixed some docs typos in pygame/pygame#3027 and pygame/pygame#3044
New contributor @brccabral improved the mask example by selecting an image that would actually get an interesting mask, in pygame/pygame#3111.
New contributor @wxh06 updated a list of datafiles relevant to the docs in pygame/pygame#3073.
New contributor @dbrown3562 improved many of our example programs in pygame/pygame#3092 and pygame/pygame#3146
New contributor @thanice improved the cursors example in pygame/pygame#3037.
New contributor @blankRiot96 improved the textinput example in pygame/pygame#3050.
New contributor @kharissa fixed Chimp tutorial code to use the correct module name alias in pygame/pygame#3205
New contributor @elgcodes corrected some typos in tutorials in pygame/pygame#3164 and pygame/pygame#3165.
New contributor @EunhoKang fixed typo in korean document in pygame/pygame#3176
New contributor @StarDexterity fixed typos in sprite docs in pygame/pygame#3263
New contributor @fQ7N Fix sprite docs DrawPlain
---> RenderPlain
in pygame/pygame#3298
New contributor @muelletm fixed typo in aliens example in pygame/pygame#3485
New contributor @oddbookworm improved pygame.math
documentation in pygame/pygame#3359 and pygame/pygame#3373
New contributor @JoshuaDRose
- updated DisplayModes.rst - PEP Changes in pygame/pygame#3385
- fixed a typo in
SpriteIntro.rst
in pygame/pygame#3154.
New contributor @Vicky-Vicky27
- Improved
mixer.set_reserved()
documentation in pygame/pygame#3434 - fixed docs and types for
math.Vector2.cross()
return to float in pygame/pygame#3286
New contributor @stefpivser added Spanish translation of chimp tutorial in pygame/pygame#3421
New contributor @pycoinfu refactored examples/mask.py
in pygame/pygame#3455
New contributor @cvionis corrected a typo in tom_games3.rst
in pygame/pygame#3504
@MyreMylar and new contributor @davidpendergast overhauled the "newbie guide" in pygame/pygame#3118 and pygame/pygame#2718 respectively
@hnrkcode made the header of the documentation look nice and pretty in pygame/pygame#3094
- Improved README in pygame/pygame#3090 and pygame/pygame#3091
- Cleaned up test/README.TXT in pygame/pygame#3254
- Prettify joystick documentation + add Nintendo Switch mapping in pygame/pygame#3290
- overview.rst -> 개요.rst in pygame/pygame#3474
@dr0id helped keep the docs building nicely by fixing a warning in pygame/pygame#3029.
@Grimmys fixed an issue where a few pages weren't added to the built documentation in pygame/pygame#2977.
- Updated the image documentation and corrected an image typehint in pygame/pygame#2959
- Improved the draw docs and example in pygame/pygame#3074
- Corrected some incorrect info about the
DOUBLEBUF
flag in pygame/pygame#3129 - Freshened up
arraydemo.py
in pygame/pygame#3453
@illume fixed es folder location as well some Sphinx issues in ChimpanceLineaporLinea.rst
in pygame/pygame#3473
@illume added experimental feedback links to new APIs in pygame/pygame#3511
New Contributors
This release has seen a phenomenal rise in the number of new contributors, special shout out to people who are contributing for the first time! No matter the size or way of the contribution, we sincerely appreciate all ways the community is helping the pygame project.
@SergioArnaud @JovialKnoll @eoghanriley @gresm @ThanhChinhBK @GregoryMorse @thanice @blankRiot96 @wxh06 @SnoopJ @brccabral @mariospapaz @JoshuaDRose @Matiiss @dbrown3562 @elgcodes @EunhoKang @PurityLake @Yvant2000 @kharissa @StarDexterity @SSS-Says-Snek @ryanking13 @kevin-pease @Vicky-Vicky27 @fQ7N @itzpr3d4t0r @rlatowicz @Emc2356 @JamesC01 @oddbookworm @Vazno @lebedevhhh @stefpivser @pycoinfu @muelletm @Temmie3754 @davidpendergast @cvionis
Thank you one and all
Sincere thanks to everyone keeping the pygame project going strong! This is not just limited to our contributors on Github, but also thousands of pygame learners and enthusiasts all around the world.
Special thanks to
- people submitting issues and PRs, answering questions, making guides and tutorials, sharing your work, or moderating discussions on different forums.
- code reviewers for helping with PRs that people make.
If we've missed someone in these notes or made any other mistake, don't hesitate to get in touch with us to make a correction.