Skip to content

Commit ec44f2a

Browse files
committed
Merge branch 'main' of https://github.com/pygame-community/pygame-ce into surface-multiphase-init
2 parents f531d0b + 426d532 commit ec44f2a

File tree

10 files changed

+1053
-19
lines changed

10 files changed

+1053
-19
lines changed

buildconfig/stubs/pygame/image.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ def load_sized_svg(file: FileLike, size: Point) -> Surface:
136136
.. versionadded:: 2.4.0
137137
"""
138138

139-
def load_animation(file: FileLike, namehint: str = "") -> list[tuple[Surface, int]]:
140-
"""Load an animation (GIF/WEBP) from a file (or file-like object).
139+
def load_animation(file: FileLike, namehint: str = "") -> list[tuple[Surface, float]]:
140+
"""Load an animation (GIF/WEBP) from a file (or file-like object) as a list of frames.
141141
142142
Load an animation (GIF/WEBP) from a file source. You can pass either a
143143
filename, a Python file-like object, or a pathlib.Path. If you pass a raw
@@ -146,7 +146,7 @@ def load_animation(file: FileLike, namehint: str = "") -> list[tuple[Surface, in
146146
format.
147147
148148
This returns a list of tuples (corresponding to every frame of the animation),
149-
where each tuple is a (surface, delay) pair for that frame.
149+
where each tuple is a (surface, delay in milliseconds) pair for that frame.
150150
151151
This function requires SDL_image 2.6.0 or above. If pygame was compiled with
152152
an older version, ``pygame.error`` will be raised when this function is

buildconfig/stubs/pygame/math.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ class Vector2(_GenericVector):
209209
xy: Vector2
210210
yx: Vector2
211211
yy: Vector2
212+
@property
213+
def angle(self) -> float: ...
214+
@property
215+
def angle_rad(self) -> float: ...
212216
@overload
213217
def __init__(
214218
self: _TVec,

docs/reST/ref/math.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,27 @@ Multiple coordinates can be set using slices or swizzling
616616
find that either the margin is too large or too small, in which case changing ``epsilon`` slightly
617617
might help you out.
618618

619+
.. attribute:: angle
620+
621+
| :sl:`Gives the angle of the vector in degrees, relative to the X-axis, normalized to the interval [-180, 180].`
622+
623+
Read-only attribute representing the angle of the vector in degrees relative to the X-axis. This angle is normalized to
624+
the interval [-180, 180].
625+
626+
Usage: Accessing `angle` provides the current angle of the vector in degrees within the predefined range of [-180, 180].
627+
628+
.. versionadded:: 2.5.5
629+
630+
.. attribute:: angle_rad
631+
632+
| :sl:`Gives the angle of the vector in radians, relative to the X-axis, normalized to the interval [-π, π].`
633+
634+
Read-only attribute representing the angle of the vector in radians relative to the X-axis. This value is equivalent
635+
to the `angle` attribute converted to radians and is normalized to the interval [-π, π].
636+
637+
Usage: Accessing `angle_rad` provides the current angle of the vector in radians within the predefined range of [-π, π].
638+
639+
.. versionadded:: 2.5.5
619640

620641
.. ## pygame.math.Vector2 ##
621642

src_c/doc/image_doc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define DOC_IMAGE "Pygame module for image transfer."
33
#define DOC_IMAGE_LOAD "load(file, namehint='') -> Surface\nLoad new image from a file (or file-like object)."
44
#define DOC_IMAGE_LOADSIZEDSVG "load_sized_svg(file, size) -> Surface\nLoad an SVG image from a file (or file-like object) with the given size."
5-
#define DOC_IMAGE_LOADANIMATION "load_animation(file, namehint='') -> list[tuple[Surface, int]]\nLoad an animation (GIF/WEBP) from a file (or file-like object)."
5+
#define DOC_IMAGE_LOADANIMATION "load_animation(file, namehint='') -> list[tuple[Surface, float]]\nLoad an animation (GIF/WEBP) from a file (or file-like object) as a list of frames."
66
#define DOC_IMAGE_SAVE "save(surface, file, namehint='') -> None\nSave an image to file (or file-like object)."
77
#define DOC_IMAGE_GETSDLIMAGEVERSION "get_sdl_image_version(linked=True) -> Optional[tuple[int, int, int]]\nGet version number of the SDL_Image library being used."
88
#define DOC_IMAGE_GETEXTENDED "get_extended() -> bool\nTest if extended image formats can be loaded."

src_c/doc/math_doc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#define DOC_MATH_VECTOR2_CLAMPMAGNITUDEIP "clamp_magnitude_ip(max_length, /) -> None\nclamp_magnitude_ip(min_length, max_length, /) -> None\nClamps the vector's magnitude between max_length and min_length"
4141
#define DOC_MATH_VECTOR2_UPDATE "update() -> None\nupdate(int) -> None\nupdate(float) -> None\nupdate(Vector2) -> None\nupdate(x, y) -> None\nupdate((x, y)) -> None\nSets the coordinates of the vector."
4242
#define DOC_MATH_VECTOR2_EPSILON "Determines the tolerance of vector calculations."
43+
#define DOC_MATH_VECTOR2_ANGLE "Gives the angle of the vector in degrees, relative to the X-axis, normalized to the interval [-180, 180]."
44+
#define DOC_MATH_VECTOR2_ANGLERAD "Gives the angle of the vector in radians, relative to the X-axis, normalized to the interval [-π, π]."
4345
#define DOC_MATH_VECTOR3 "Vector3() -> Vector3(0, 0, 0)\nVector3(int) -> Vector3\nVector3(float) -> Vector3\nVector3(Vector3) -> Vector3\nVector3(x, y, z) -> Vector3\nVector3((x, y, z)) -> Vector3\na 3-Dimensional Vector"
4446
#define DOC_MATH_VECTOR3_DOT "dot(Vector3, /) -> float\ncalculates the dot- or scalar-product with the other vector"
4547
#define DOC_MATH_VECTOR3_CROSS "cross(Vector3, /) -> Vector3\ncalculates the cross- or vector-product"

src_c/imageext.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ imageext_load_animation(PyObject *self, PyObject *arg, PyObject *kwargs)
264264
* to null in the animation to prevent double free */
265265
surfs->frames[i] = NULL;
266266

267-
PyObject *listentry = Py_BuildValue("(Oi)", frame, surfs->delays[i]);
267+
PyObject *listentry =
268+
Py_BuildValue("(Od)", frame, (double)surfs->delays[i]);
268269
Py_DECREF(frame);
269270
if (!listentry) {
270271
goto error;

0 commit comments

Comments
 (0)