[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Re: Starting the pygame 2 series



 ,--.
|  oo|
|  ~~| o  o  o  o  o  o  o  o  o  o  o
|/\/\|
       pip install pygame==2.0.0.dev10

We only released 2.0.0.dev8 24 days ago. However, the last few weeks have been quite productive!
It's as if we were all trapped inside for some reason.

First up, the 'critical' window resizing bugfix thanks to @robertpfeiffer but also to @nthykier. This is another step towards a backwards compatible pygame 2 release. Another 'critical' bug (backwards compatibility bugs that block a pygame 2 release from happening) that got a fix is the pygame.display.update() call on windows. A patch has been merged into SDL so this should be fixed in pygame soon.

Community help

A special thanks to all the people who help out others. From making videos, to answering questions, to writing guides. MyreMylar, MichaelCPalmer, jtiai, claudeb, DaFluffyPotato, Rabbid76, The Big Kahuna, sloth, Kingsley, ... and lots of other people.

Type hints, and lint tools

The last pygame pre-release(2.0.0.dev8) shipped with Type hints, and now Type hints have been refined (not like oil, but more like an expensive fermented vegan cheese). Thanks to Josip Komljenović aka @MightyJosip

Documentation and tutorials

                                       _________________________
                                     =(__    ___       __     __)=
                                       |                       |
                                       |                       |
                                       | python -m pygame.docs |
                                       |                       |
                                       | The type hints were a |
                                       | major part of the doc |
                                       | work in this release. |
                                       | Some examples got an  |
                                       | update too.           |
                                       |__    ___   __    _____|
                                     =(_________________________)=

an amazing assortment of ammendments

And now have an ARM64 build for testing pygame on Travis CI (who provide it to us for free thanks!). Additionally a few bugs on the release process were fixed. Hopefully this will help us keep things working nicely on ARM platforms like the raspberry PI.

Thanks to @galexandreg Surface.blit can now take very large rects for the area argument. Which is very useful in open world games that could have huge sizes of surfaces. With SDL1 supporting only smaller rects and surfaces, it used to be limited to a 16bit number.

SCALED is a feature for scaling up low resolution game screens to large size screens - like 4k monitors or high resolution phone screens. This received some code cleanups and documentation. Thanks to @robertpfeiffer, and to @nthykier and @MyreMylar for help reviewing/testing.

pygame using SDL1 is building and passing tests again thanks to @MyreMylar and @illume. We stopped testing with SDL1 some time ago, whilst still sort of supporting it theoretically... but then bitrot set in and a few things stopped working again. Why do we want to keep doing this? It's useful for backwards compatibility testing. Additionally SDL1 is still better in a few tiny ways - the main one being on some ancient embedded linux platforms.

As part of a code robustness adventure of fixing... surface.blits was fixed for low memory situations where thanks to @nthykier.

Add support for controlling screensaver state by @nthykier and continued on in #1843 allows changing the behaviour of pygame with regards to screensavers. By default pygame disables screensavers, which is good for games because you don't want a screensaver kicking in midway through a cut-scene. But some apps don't need this behaviour. So pygame.display.set_allow_screensaver(True)

camera

                               ___
                       __()}|=|   |]          pygame.camera
                       (   \/ |___|
                       |       /|\
                      /|      / | \

The pygame.camera on windows got some fixes so that it works well on SDL2 with the VideoCapture module. In the process @MyreMylar made some improvements to pygame.image.frombuffer - the function used to quickly share large buffers of data with pygame and other modules.

Mask

                                                        ▓▓
                      ░░                  ▓▓██▒▒        ▒▒▒▒░░
                      ░░░░  ░░▒▒░░░░    ▒▒▓▓████░░      ▓▓▓▓▒▒
                      ▒▒▒▒▒▒▒▒▒▒▒▒▒▒░░▒▒▓▓▓▓████▓▓░░▒▒▓▓▓▓▒▒▒▒
                    ░░▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▓▓▓▓▓▓████▓▓▓▓▓▓▓▓▓▓▒▒▒▒░░
                ▒▒░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓██████▓▓▓▓▓▓▒▒▒▒▒▒▒▒      ░░
                ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓████▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒
                  ▒▒▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓▓████▓▓▓▓██▓▓▒▒▒▒░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓
                    ▒▒▒▒            ░░▒▒▓▓▓▓██▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▒▒░░
                    ▒▒▒▒▓▓            ░░▒▒▓▓██▓▓▓▓          ▒▒▓▓▓▓▓▓▒▒
                    ░░▓▓▒▒▒▒            ▒▒▒▒██▓▓▒▒        ▒▒▒▒▓▓▓▓▓▓
                      ▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒██▓▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓▒▒▓▓▒▒
                      ░░▒▒▓▓▓▓▒▒▒▒▓▓▓▓▒▒▓▓▒▒██▒▒▓▓▒▒▓▓▒▒▓▓▓▓▒▒▓▓▓▓
                        ░░▒▒▓▓▓▓▓▓▓▓▒▒▓▓▓▓▒▒██▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒

                        pygame.Mask -- when 1 bit is enough

Mask.to_surface is a way to draw 1bit Mask objects to surfaces. 1bit surfaces are great because they can be processed up to 32x faster than Surfaces with a large color depth(since Surfaces use up to 32bits per pixel). Great for pixel perfect collision detection in particular. Mask.to_surface is already useful, but Charles (aka @charlesej) has been working on preparing to implement the area keyword as seen in Surface.blit.

This could be interesting to those people interested in doing deformable terrain.

good first issue

'goodfirstissue' is a label applied to issues which would be good for someone who wants to try contributing to a Free, Open Source, or community project (like pygame).

Dan Lawrence (aka @MyreMylar) has been hard at work preparing almost 100 "good first issue"s for people to do.

Here are some of the first time contributors:

Daniel Gillet (aka @dangillet) worked on making [saving images to BytesIO/StringIO]](#1858) work.

Thanks to kbanger on discord for looking into this "ljpeg and lpng missing in Setup.SDL2.in" issue, and also for working on updating the pygame buildroot package.

Fonts matter (don't they?)

Font got a touch of modernization applied to it. font.bold = True, font.underline = True and font.italics = True are now things... rather than having to do a font.set_bold(True). Now the freetype Font object has a 'bgcolor' attribute to mirror existing 'fgcolor' one. ftfont.Font: Fix NameError when resolution is 0 Thanks to Niels Thykier, aka @nthykier

SysFont is used to load fonts which are already installed on users systems. It's historically been complex and often not working so well. Not anymore! @MyreMylar made some first steps at adding sysfont tests, and updating the font lists for windows and ubuntu. Then @illume noticed some of those new tests failing on MacOS, because sysfont._add_font_paths was adding ttf to 'simple font names'. So now it's working better on the Mac too.

Optimizations

Adds MMX, SSE2 & Arm NEON optimised versions of blit_blend_premultiplied() @MyreMylar
Some tweaks to the pre-multiply alpha blending

Add a SSE4.2 optimized version of image_tostring for some 32bit surfaces @nthykier

MSVC compiler optimisation hinting, 1% smaller pygame on windows @MyreMylar

Faster methods for drawing filled rects and circles of all kinds, care of @robertpfeiffer

As a small speed up Surface.blits was used in the pygame.sprite module to speed it up a little bit.

Bug fixes and Cleanups

The static code analysis tool by microsoft "/analyze" is now being used. Thanks to Dan Lawrence, aka @MyreMylar #1328

setup: Error out on unused-value warnings with -pygame-ci @nthykier

Clean up incompatible pointer casts and add a -Werror for it in the CI builds @nthykier

Add pgRect_Normalize to C API

@PeanutbutterWarrior noticed that not all of the modules returned a boolean, sometimes they returned an int Then @MyreMylar stepped up and made a PR to Always return bool from get_init() instead of sometimes returning int

Reject attempts to delete attributes in that cannot be deleted @nthykier

>>> import pygame
>>> c = pygame.color.Color('black')
>>> del c.a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: Cannot delete attribute a

Freetype font int casting fix Dan Lawrence (aka @MyreMylar)

In MacOS we had a problem where Default SDL render driver back to opengl from the metal renderer. This had to do with a problem with our new conan based dependency compilation on MacOS. Hopefully that's fixed now.

Issue gardening

            ********
        ****************
      *******************
      ********************
       ********************         wWWWw               wWWWw
          \\   //  ********   vVVVv (___) wWWWw         (___)  vVVVv
           \\\//  *******     (___)  ~Y~  (___)  vVVVv   ~Y~   (___)
             \\\////           ~Y~   \|    ~Y~   (___)    |/    ~Y~
              |||//            \|   \ |/   \| /  \~Y~/   \|    \ |/
              |||||           \\|// \\|// \\|/// \\|//  \\|// \\\|///
  ,,,,,,,,,,,//||||\,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

This time 2 'critical' backwards compatibility issues were fixed since the last release. Also plenty of work went into looking at the alpha blit issue, and the color key issues.

@MyreMylar made a great effort creating some good first issues, but also continued to go through a lot of older issues seeing if they could reproduce them, and asking questions of the original reporter, and also fixing a few here and there. As a result our issue garden is doing pretty well.