Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename pygame.typing.Coordinate to Point, fix related grammar #3139

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reST/ref/cursors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ The following strings can be converted into cursor bitmaps with
**Creating a color cursor**

To create a color cursor, create a ``Cursor`` from a ``hotspot`` and a ``surface``.
``hotspot`` is an (x,y) coordinate that determines where in the cursor the exact point is.
``hotspot`` are (x,y) coordinates that determine where in the cursor the exact point is.
The hotspot position must be within the bounds of the ``surface``.

**Creating a bitmap cursor**
Expand Down
16 changes: 8 additions & 8 deletions docs/reST/ref/draw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ object around the draw calls (see :func:`pygame.Surface.lock` and
tuple ``(RGB[A])``
:type color: Color or string (for :doc:`color_list`) or int or tuple(int, int, int, [int])
:param points: a sequence of 3 or more (x, y) coordinates that make up the
vertices of the polygon, each *coordinate* in the sequence must be a
vertices of the polygon, each point in the sequence must be a
tuple/list/:class:`pygame.math.Vector2` of 2 ints/floats,
e.g. ``[(x1, y1), (x2, y2), (x3, y3)]``
:type points: tuple(coordinate) or list(coordinate)
:type points: tuple(point) or list(point)
:param int width: (optional) used for line thickness or to indicate that
the polygon is to be filled

Expand Down Expand Up @@ -420,14 +420,14 @@ object around the draw calls (see :func:`pygame.Surface.lock` and
:param bool closed: if ``True`` an additional line segment is drawn between
the first and last points in the ``points`` sequence
:param points: a sequence of 2 or more (x, y) coordinates, where each
*coordinate* in the sequence must be a
point in the sequence must be a
tuple/list/:class:`pygame.math.Vector2` of 2 ints/floats and adjacent
coordinates will be connected by a line segment, e.g. for the
points will be connected by a line segment, e.g. for the
points ``[(x1, y1), (x2, y2), (x3, y3)]`` a line segment will be drawn
from ``(x1, y1)`` to ``(x2, y2)`` and from ``(x2, y2)`` to ``(x3, y3)``,
additionally if the ``closed`` parameter is ``True`` another line segment
will be drawn from ``(x3, y3)`` to ``(x1, y1)``
:type points: tuple(coordinate) or list(coordinate)
:type points: tuple(point) or list(point)
:param int width: (optional) used for line thickness

| if width >= 1, used for line thickness (default is 1)
Expand Down Expand Up @@ -573,14 +573,14 @@ object around the draw calls (see :func:`pygame.Surface.lock` and
:param bool closed: if ``True`` an additional line segment is drawn between
the first and last points in the ``points`` sequence
:param points: a sequence of 2 or more (x, y) coordinates, where each
*coordinate* in the sequence must be a
point in the sequence must be a
tuple/list/:class:`pygame.math.Vector2` of 2 ints/floats and adjacent
coordinates will be connected by a line segment, e.g. for the
points will be connected by a line segment, e.g. for the
points ``[(x1, y1), (x2, y2), (x3, y3)]`` a line segment will be drawn
from ``(x1, y1)`` to ``(x2, y2)`` and from ``(x2, y2)`` to ``(x3, y3)``,
additionally if the ``closed`` parameter is ``True`` another line segment
will be drawn from ``(x3, y3)`` to ``(x1, y1)``
:type points: tuple(coordinate) or list(coordinate)
:type points: tuple(point) or list(point)

:returns: a rect bounding the changed pixels, if nothing is drawn the
bounding rect's position will be the position of the first point in the
Expand Down
38 changes: 19 additions & 19 deletions docs/reST/ref/gfxdraw.rst
Original file line number Diff line number Diff line change
Expand Up @@ -470,18 +470,18 @@ For example:
Draws an unfilled polygon on the given surface. For a filled polygon use
:meth:`filled_polygon`.

The adjacent coordinates in the ``points`` argument, as well as the first
The adjacent points in the ``points`` argument, as well as the first
and last points, will be connected by line segments.
e.g. For the points ``[(x1, y1), (x2, y2), (x3, y3)]`` a line segment will
be drawn from ``(x1, y1)`` to ``(x2, y2)``, from ``(x2, y2)`` to
``(x3, y3)``, and from ``(x3, y3)`` to ``(x1, y1)``.

:param Surface surface: surface to draw on
:param points: a sequence of 3 or more (x, y) coordinates, where each
*coordinate* in the sequence must be a
point in the sequence must be a
tuple/list/:class:`pygame.math.Vector2` of 2 ints/floats (float values
will be truncated)
:type points: tuple(coordinate) or list(coordinate)
:type points: tuple(point) or list(point)
:param color: color to draw with, the alpha value is optional if using a
tuple ``(RGB[A])``
:type color: Color or tuple(int, int, int, [int])
Expand All @@ -490,7 +490,7 @@ For example:
:rtype: NoneType

:raises ValueError: if ``len(points) < 3`` (must have at least 3 points)
:raises IndexError: if ``len(coordinate) < 2`` (each coordinate must have
:raises IndexError: if ``len(point) < 2`` (each point must have
at least 2 items)

.. ## pygame.gfxdraw.polygon ##
Expand All @@ -502,18 +502,18 @@ For example:

Draws an unfilled antialiased polygon on the given surface.

The adjacent coordinates in the ``points`` argument, as well as the first
The adjacent points in the ``points`` argument, as well as the first
and last points, will be connected by line segments.
e.g. For the points ``[(x1, y1), (x2, y2), (x3, y3)]`` a line segment will
be drawn from ``(x1, y1)`` to ``(x2, y2)``, from ``(x2, y2)`` to
``(x3, y3)``, and from ``(x3, y3)`` to ``(x1, y1)``.

:param Surface surface: surface to draw on
:param points: a sequence of 3 or more (x, y) coordinates, where each
*coordinate* in the sequence must be a
point in the sequence must be a
tuple/list/:class:`pygame.math.Vector2` of 2 ints/floats (float values
will be truncated)
:type points: tuple(coordinate) or list(coordinate)
:type points: tuple(point) or list(point)
:param color: color to draw with, the alpha value is optional if using a
tuple ``(RGB[A])``
:type color: Color or tuple(int, int, int, [int])
Expand All @@ -522,7 +522,7 @@ For example:
:rtype: NoneType

:raises ValueError: if ``len(points) < 3`` (must have at least 3 points)
:raises IndexError: if ``len(coordinate) < 2`` (each coordinate must have
:raises IndexError: if ``len(point) < 2`` (each point must have
at least 2 items)

.. ## pygame.gfxdraw.aapolygon ##
Expand All @@ -535,18 +535,18 @@ For example:
Draws a filled polygon on the given surface. For an unfilled polygon use
:meth:`polygon`.

The adjacent coordinates in the ``points`` argument, as well as the first
The adjacent pooints in the ``points`` argument, as well as the first
aatle marked this conversation as resolved.
Show resolved Hide resolved
and last points, will be connected by line segments.
e.g. For the points ``[(x1, y1), (x2, y2), (x3, y3)]`` a line segment will
be drawn from ``(x1, y1)`` to ``(x2, y2)``, from ``(x2, y2)`` to
``(x3, y3)``, and from ``(x3, y3)`` to ``(x1, y1)``.

:param Surface surface: surface to draw on
:param points: a sequence of 3 or more (x, y) coordinates, where each
*coordinate* in the sequence must be a
point in the sequence must be a
tuple/list/:class:`pygame.math.Vector2` of 2 ints/floats (float values
will be truncated)`
:type points: tuple(coordinate) or list(coordinate)
:type points: tuple(point) or list(point)
:param color: color to draw with, the alpha value is optional if using a
tuple ``(RGB[A])``
:type color: Color or tuple(int, int, int, [int])
Expand All @@ -555,7 +555,7 @@ For example:
:rtype: NoneType

:raises ValueError: if ``len(points) < 3`` (must have at least 3 points)
:raises IndexError: if ``len(coordinate) < 2`` (each coordinate must have
:raises IndexError: if ``len(point) < 2`` (each point must have
at least 2 items)

.. ## pygame.gfxdraw.filled_polygon ##
Expand All @@ -572,18 +572,18 @@ For example:
a :func:`pygame.Surface.blit` blit. Also, a per-pixel alpha texture cannot be
used with an 8-bit per pixel destination.

The adjacent coordinates in the ``points`` argument, as well as the first
The adjacent points in the ``points`` argument, as well as the first
and last points, will be connected by line segments.
e.g. For the points ``[(x1, y1), (x2, y2), (x3, y3)]`` a line segment will
be drawn from ``(x1, y1)`` to ``(x2, y2)``, from ``(x2, y2)`` to
``(x3, y3)``, and from ``(x3, y3)`` to ``(x1, y1)``.

:param Surface surface: surface to draw on
:param points: a sequence of 3 or more (x, y) coordinates, where each
*coordinate* in the sequence must be a
point in the sequence must be a
tuple/list/:class:`pygame.math.Vector2` of 2 ints/floats (float values
will be truncated)
:type points: tuple(coordinate) or list(coordinate)
:type points: tuple(point) or list(point)
:param Surface texture: texture to draw on the polygon
:param int tx: x offset of the texture
:param int ty: y offset of the texture
Expand All @@ -592,7 +592,7 @@ For example:
:rtype: NoneType

:raises ValueError: if ``len(points) < 3`` (must have at least 3 points)
:raises IndexError: if ``len(coordinate) < 2`` (each coordinate must have
:raises IndexError: if ``len(point) < 2`` (each point must have
at least 2 items)

.. ## pygame.gfxdraw.textured_polygon ##
Expand All @@ -606,10 +606,10 @@ For example:

:param Surface surface: surface to draw on
:param points: a sequence of 3 or more (x, y) coordinates used to form a
curve, where each *coordinate* in the sequence must be a
curve, where each point in the sequence must be a
tuple/list/:class:`pygame.math.Vector2` of 2 ints/floats (float values
will be truncated)
:type points: tuple(coordinate) or list(coordinate)
:type points: tuple(point) or list(point)
:param int steps: number of steps for the interpolation, the minimum is 2
:param color: color to draw with, the alpha value is optional if using a
tuple ``(RGB[A])``
Expand All @@ -620,7 +620,7 @@ For example:

:raises ValueError: if ``steps < 2``
:raises ValueError: if ``len(points) < 3`` (must have at least 3 points)
:raises IndexError: if ``len(coordinate) < 2`` (each coordinate must have
:raises IndexError: if ``len(point) < 2`` (each point must have
at least 2 items)

.. note:: This function supports up to around 150-200 points before the algorithm
Expand Down
6 changes: 3 additions & 3 deletions docs/reST/ref/sdl2_video.rst
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@
| :sl:`Get or set the Image's origin of rotation`
| :sg:`origin -> (float, float) or None`

Gets or sets the Image's origin of rotation, a 2D coordinate relative to
the topleft coordinate of the Image's rectangular area.
Gets or sets the Image's origin of rotation, a 2D point relative to
the topleft coordinates of the Image's rectangular area.

An origin of ``None`` means no origin was set and the Image will be
rotated around its center.
Expand Down Expand Up @@ -452,7 +452,7 @@
| :sl:`Draw a point`
| :sg:`draw_point(point) -> None`

:param point: The point's coordinate.
:param point: The point's coordinates.

.. method:: draw_rect

Expand Down
2 changes: 1 addition & 1 deletion docs/reST/ref/surface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
If it has transparency, transparent pixels will be ignored when blittting to an 8-bit ``Surface``.
- ``dest`` *(optional)*
The ``source`` draw position onto this ``Surface``, defaults to (0, 0).
It can be a coordinate ``(x, y)`` or a ``Rect`` (using its top-left corner).
It can be a coordinate pair ``(x, y)`` or a ``Rect`` (using its top-left corner).
If a ``Rect`` is passed, its size will not affect the blit.
- ``area`` *(optional)*
The rectangular portion of the ``source`` to draw.
Expand Down
10 changes: 5 additions & 5 deletions docs/reST/ref/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
.. versionadded:: 2.5.2

A lot of pygame functions and methods allow the user to provide different types
for the same value like colors or coordinates. This module exports the most common
for the same value like colors or points. This module exports the most common
type aliases for proper typehint annotations.

.. data:: FileLike
Expand All @@ -38,15 +38,15 @@ type aliases for proper typehint annotations.
Being a generic, subscribing it will signal further precision such as
``SequenceLike[str]`` or ``SequenceLike[float]``.

.. data:: Coordinate
.. data:: Point

A sequence of two numbers (floats or ints), i.e:

* ``pygame.Vector2(a, b)``
* ``[a, b]``
* ``(a, b)``

.. data:: IntCoordinate
.. data:: IntPoint

A sequence of strictly two integers such as ``[a, b]`` or ``(a, b)``.

Expand All @@ -65,12 +65,12 @@ type aliases for proper typehint annotations.

.. data:: RectLike

An object representing a rect such as a sequence of numbers or coordinates
An object representing a rect such as a sequence of numbers or points
or an object with a rect attribute or a method returning a rect. These types
are supported by every function accepting a rect as argument. i.e.:

* ``(x, y, w, h)``
* ``(Coordinate, Coordinate)``
* ``(Point, Point)``
* ``pygame.Rect(RectLike)``
* Any object with a ``.rect`` attribute which is a ``RectLike`` or a function
returning a ``RectLike``
Expand Down
4 changes: 2 additions & 2 deletions docs/reST/tutorials/en/intro-to-camera.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ use it to control an on screen object.
# make sure the blob is big enough that it isn't just noise
if mask.count() > 100:
# find the center of the blob
coord = mask.centroid()
coords = mask.centroid()
# draw a circle with size variable on the size of the blob
pygame.draw.circle(self.display, (0,255,0), coord, max(min(50,mask.count()/400),5))
pygame.draw.circle(self.display, (0,255,0), coords, max(min(50,mask.count()/400),5))
pygame.display.flip()

.. image:: ../assets/camera_mask.jpg
Expand Down
6 changes: 3 additions & 3 deletions docs/reST/tutorials/en/move-it.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pygame is very straightforward. We'll pretend we have loaded some pretty
graphics and named them "terrain1", "terrain2", and "hero". Where before
we assigned numbers to a list, we now blit graphics to the screen. Another
big change, instead of using positions as a single index (0 through 5), we
now need a two dimensional coordinate. We'll pretend each of the graphics
now need a two dimensional point. We'll pretend each of the graphics
in our game is 10 pixels wide. ::

>>> background = [terrain1, terrain1, terrain2, terrain2, terrain2, terrain1]
Expand Down Expand Up @@ -246,9 +246,9 @@ Screen Coordinates
------------------

To position an object on the screen, we need to tell the blit() function
where to put the image. In pygame we always pass positions as an (X,Y) coordinate.
where to put the image. In pygame we always pass positions as (X,Y) coordinates.
This represents the number of pixels to the right, and the number of pixels
down to place the image. The top-left corner of a Surface is coordinate (0,
down to place the image. The top-left corner of a Surface is coordinates (0,
0). Moving to the right a little would be (10, 0), and then moving down just
as much would be (10, 10). When blitting, the position argument represents
where the topleft corner of the source should be placed on the destination.
Expand Down