Skip to content

Commit 34f230b

Browse files
committed
Merge branch 'main' into fix-premul-alpha-bytewidth
2 parents 8b28d80 + 9b7b46c commit 34f230b

33 files changed

+952
-141
lines changed

.gitattributes

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# define files/directories that won't be exported in an sdist
2+
# Keep in sync with MANIFEST.in
3+
.circleci/ export-ignore
4+
.github/ export-ignore
5+
buildconfig/ci/ export-ignore
6+
buildconfig/macdependencies/ export-ignore
7+
buildconfig/manylinux-build/ export-ignore
8+
9+
.editorconfig export-ignore
10+
.gitattributes export-ignore
11+
.gitignore export-ignore
12+
.pre-commit-config.yaml export-ignore

.github/workflows/build-manylinux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
- uses: actions/checkout@v4.1.6
7878

7979
- name: Log in to the Container registry
80-
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
80+
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
8181
with:
8282
registry: ghcr.io
8383
username: ${{ github.actor }}

.github/workflows/build-ubuntu-sdist.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,14 @@ jobs:
6060
# https://github.com/orgs/community/discussions/47863
6161
run: |
6262
sudo apt-get update --fix-missing
63-
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-setuptools python3-dev
63+
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libfreetype6-dev libportmidi-dev python3-dev
6464
pip3 install --upgrade pip
65-
pip3 install sphinx"<7.2.0" numpy>=1.21.0
65+
pip3 install build numpy>=1.21.0
6666
6767
- name: Make sdist and install it
6868
run: |
69-
python3 buildconfig/make_docs.py
70-
python3 setup.py sdist
71-
pip3 install dist/pygame-*.tar.gz -vv
69+
python3 -m build --sdist --outdir dist .
70+
pip3 install dist/pygame_ce-*.tar.gz -vv
7271
7372
- name: Run tests
7473
env:

README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:target: https://pyga.me/
44

55

6-
|DocsStatus|
6+
|DocsStatus|
77
|PyPiVersion| |PyPiLicense|
88
|Python3| |GithubCommits| |BlackFormatBadge|
99

@@ -47,7 +47,7 @@ locally, it'll launch the online website instead.
4747

4848
The online documentation stays up to date with the development version
4949
of pygame on github. This may be a bit newer than the version of pygame
50-
you are using. To upgrade to the latest full release, run
50+
you are using. To upgrade to the latest full release, run
5151
``pip install pygame-ce --upgrade`` in your terminal.
5252

5353
Best of all, the examples directory has many playable small programs
@@ -101,7 +101,7 @@ Tyler, Nathaniel Pryce, Dave Wallace, John Popplewell, Michael Urman,
101101
Andrew Straw, Michael Hudson, Ole Martin Bjoerndalen, Herve Cauwelier,
102102
James Mazer, Lalo Martins, Timothy Stranex, Chad Lester, Matthias
103103
Spiller, Bo Jangeborg, Dmitry Borisov, Campbell Barton, Diego Essaya,
104-
Eyal Lotem, Regis Desgroppes, Emmanuel Hainry, Randy Kaelber
104+
Eyal Lotem, Regis Desgroppes, Emmanuel Hainry, Randy Kaelber,
105105
Matthew L Daniel, Nirav Patel, Forrest Voight, Charlie Nolan,
106106
Frankie Robertson, John Krukoff, Lorenz Quack, Nick Irvine,
107107
Michael George, Saul Spatz, Thomas Ibbotson, Tom Rothamel, Evan Kroske,
@@ -132,7 +132,7 @@ Pygame is obviously strongly dependent on SDL and Python. It also
132132
links to and embeds several other smaller libraries. The font
133133
module relies on SDL_ttf, which is dependent on freetype. The mixer
134134
(and mixer.music) modules depend on SDL_mixer. The image module
135-
depends on SDL_image. Transform.rotozoom has an embedded version
135+
depends on SDL_image. Transform.rotozoom has an embedded version
136136
of SDL_rotozoom, and gfxdraw has an embedded version of SDL_gfx.
137137
Dependency versions:
138138

@@ -176,12 +176,12 @@ See docs/licenses for licenses of dependencies.
176176

177177
.. |Python3| image:: https://img.shields.io/badge/python-3-blue.svg?v=1
178178

179-
.. |GithubCommits| image:: https://img.shields.io/github/commits-since/pygame-community/pygame-ce/2.3.0.svg
180-
:target: https://github.com/pygame-community/pygame-ce/compare/2.3.0...main
179+
.. |GithubCommits| image:: https://img.shields.io/github/commits-since/pygame-community/pygame-ce/2.4.1.svg
180+
:target: https://github.com/pygame-community/pygame-ce/compare/2.4.1...main
181181

182182
.. |DocsStatus| image:: https://img.shields.io/website?down_message=offline&label=docs&up_message=online&url=https%3A%2F%2Fpyga.me%2Fdocs%2F
183183
:target: https://pyga.me/docs/
184-
184+
185185
.. |BlackFormatBadge| image:: https://img.shields.io/badge/code%20style-black-000000.svg
186186
:target: https://github.com/psf/black
187187

buildconfig/manylinux-build/docker_base/sdl_libs/build-sdl2-libs.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@ set -e -x
33

44
cd $(dirname `readlink -f "$0"`)
55

6-
SDL2="SDL2-2.30.3"
7-
IMG2="SDL2_image-2.8.2"
8-
TTF2="SDL2_ttf-2.22.0"
9-
MIX2="SDL2_mixer-2.8.0"
6+
SDL2_VER="2.30.3"
7+
SDL2="SDL2-$SDL2_VER"
8+
IMG2_VER="2.8.2"
9+
IMG2="SDL2_image-$IMG2_VER"
10+
TTF2_VER="2.22.0"
11+
TTF2="SDL2_ttf-$TTF2_VER"
12+
MIX2_VER="2.8.0"
13+
MIX2="SDL2_mixer-$MIX2_VER"
1014

1115

1216
# Download
13-
curl -sL --retry 10 https://www.libsdl.org/release/${SDL2}.tar.gz > ${SDL2}.tar.gz
14-
# curl -sL --retry 10 https://www.libsdl.org/tmp/release/SDL2-2.0.14.tar.gz > SDL2-2.0.14.tar.gz
15-
# curl -sL --retry 10 https://hg.libsdl.org/SDL/archive/tip.tar.gz > ${SDL2}.tar.gz
16-
17-
curl -sL --retry 10 https://www.libsdl.org/projects/SDL_image/release/${IMG2}.tar.gz > ${IMG2}.tar.gz
18-
curl -sL --retry 10 https://www.libsdl.org/projects/SDL_ttf/release/${TTF2}.tar.gz > ${TTF2}.tar.gz
19-
curl -sL --retry 10 https://www.libsdl.org/projects/SDL_mixer/release/${MIX2}.tar.gz > ${MIX2}.tar.gz
17+
curl -sL --retry 10 https://github.com/libsdl-org/SDL/releases/download/release-$SDL2_VER/$SDL2.tar.gz > ${SDL2}.tar.gz
18+
curl -sL --retry 10 https://github.com/libsdl-org/SDL_image/releases/download/release-$IMG2_VER/$IMG2.tar.gz > ${IMG2}.tar.gz
19+
curl -sL --retry 10 https://github.com/libsdl-org/SDL_mixer/releases/download/release-$MIX2_VER/$MIX2.tar.gz > ${MIX2}.tar.gz
20+
curl -sL --retry 10 https://github.com/libsdl-org/SDL_ttf/releases/download/release-$TTF2_VER/$TTF2.tar.gz > ${TTF2}.tar.gz
2021
sha512sum -c sdl2.sha512
2122

2223

buildconfig/stubs/pygame/math.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ class Vector3(_GenericVector):
333333
def update(self, x: int, y: int, z: int) -> None: ...
334334

335335

336-
def lerp(a: float, b: float, weight: float, do_clamp: bool = True, /) -> float: ...
336+
def lerp(a: float, b: float, value: float, do_clamp: bool = True, /) -> float: ...
337+
def invlerp(a: float, b: float, value: float, /) -> float: ...
338+
def remap(i_min: float, i_max: float, o_min: float, o_max: float, value: float, /) -> float: ...
337339
def smoothstep(a: float, b: float, weight: float, /) -> float: ...
338340

339341

buildconfig/stubs/pygame/transform.pyi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@ def gaussian_blur(
6565
repeat_edge_pixels: bool = True,
6666
dest_surface: Optional[Surface] = None
6767
) -> Surface: ...
68+
def hsl(
69+
surface: Surface,
70+
hue: float = 0,
71+
saturation: float = 0,
72+
lightness: float = 0,
73+
dest_surface: Optional[Surface] = None,
74+
) -> Surface: ...

docs/__main__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import platform
22

3-
from pygame.docs.serve import main as serve
4-
from pygame.docs.static import main as static
3+
# use relative import here and not absolute, so that `python -m docs` works at
4+
# development time
5+
from .serve import main as serve
6+
from .static import main as static
57

68

79
def main():

docs/reST/ref/math.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,37 @@ Multiple coordinates can be set using slices or swizzling
7979

8080
.. ## math.lerp ##
8181
82+
.. function:: invlerp
83+
84+
| :sl:`returns value inverse interpolated between a and b`
85+
| :sg:`invlerp(a, b, value, /) -> float`
86+
87+
Returns a number which is an inverse interpolation between ``a``
88+
and ``b``. The third parameter ``value`` is the result of the linear interpolation
89+
between a and b with a certain coefficient. In other words, this coefficient
90+
will be the result of this function.
91+
If ``b`` and ``a`` are equal, it raises a ``ValueError``.
92+
93+
The formula is:
94+
95+
``(v - a)/(b - a)``.
96+
97+
This is an example explaining what is above :
98+
99+
.. code-block:: python
100+
101+
> a = 10
102+
> b = 20
103+
> pygame.math.invlerp(10, 20, 11.5)
104+
> 0.15
105+
> pygame.math.lerp(10, 20, 0.15)
106+
> 11.5
107+
108+
109+
.. versionadded:: 2.5.0
110+
111+
.. ## math.invlerp ##
112+
82113
.. function:: smoothstep
83114

84115
| :sl:`returns value smoothly interpolated between a and b.`
@@ -102,6 +133,28 @@ Multiple coordinates can be set using slices or swizzling
102133

103134
.. ## math.smoothstep ##
104135
136+
.. function:: remap
137+
138+
| :sl:`remaps value from given input range to given output range`
139+
| :sg:`remap(i_min, i_max, o_min, o_max, value, /) -> float`
140+
141+
Returns a number which is the value remapped from ``[i_min, i_max]`` range to
142+
``[o_min, o_max]`` range.
143+
If ``i_min`` and ``i_max`` are equal, it raises a ``ValueError``.
144+
145+
Example:
146+
147+
.. code-block:: python
148+
149+
> value = 50
150+
> pygame.math.remap(0, 100, 0, 200, value)
151+
> 100.0
152+
153+
154+
.. versionadded:: 2.5.0
155+
156+
.. ## math.remap ##
157+
105158
.. class:: Vector2
106159

107160
| :sl:`a 2-Dimensional Vector`

docs/reST/ref/mixer.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,23 @@ The following file formats are supported
576576
`angle`: Angle is in degrees.
577577

578578
`distance`: Range from 0 to 255.
579+
580+
.. warning:: This function currently fails and raises a
581+
:exc:`pygame.error` when using 7.1 surround sound.
582+
By default, the mixer module will use what the hardware is best
583+
suited for, so this leads to hardware specific exceptions when using
584+
this function.
585+
586+
One way of avoiding this is only using :func:`set_source_location`
587+
with forced stereo. For example:
588+
589+
::
590+
591+
pygame.mixer.pre_init(
592+
channels=2,
593+
allowedchanges=pygame.AUDIO_ALLOW_FREQUENCY_CHANGE,
594+
)
595+
pygame.init()
579596
580597
.. versionadded:: 2.3.0
581598

0 commit comments

Comments
 (0)