Skip to content

Commit 1a28571

Browse files
authored
Rename pygame.typing.Coordinate to Point, fix related grammar (#3139)
* Rename Coordinate classes * Fix "coordinate" grammar in docs * Generate typing_doc.h * Fix docs typo
1 parent 2adb4b2 commit 1a28571

28 files changed

+215
-215
lines changed

buildconfig/stubs/pygame/_sdl2/video.pyi

+21-21
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from pygame.rect import Rect
55
from pygame.surface import Surface
66
from pygame.window import Window as Window
77

8-
from pygame.typing import ColorLike, RectLike, Coordinate
8+
from pygame.typing import ColorLike, RectLike, Point
99

1010
WINDOWPOS_UNDEFINED: int
1111
WINDOWPOS_CENTERED: int
@@ -74,26 +74,26 @@ class Texture:
7474
) -> None: ...
7575
def draw_triangle(
7676
self,
77-
p1_xy: Coordinate,
78-
p2_xy: Coordinate,
79-
p3_xy: Coordinate,
80-
p1_uv: Coordinate = (0.0, 0.0),
81-
p2_uv: Coordinate = (1.0, 1.0),
82-
p3_uv: Coordinate = (0.0, 1.0),
77+
p1_xy: Point,
78+
p2_xy: Point,
79+
p3_xy: Point,
80+
p1_uv: Point = (0.0, 0.0),
81+
p2_uv: Point = (1.0, 1.0),
82+
p3_uv: Point = (0.0, 1.0),
8383
p1_mod: Iterable[int] = (255, 255, 255, 255),
8484
p2_mod: Iterable[int] = (255, 255, 255, 255),
8585
p3_mod: Iterable[int] = (255, 255, 255, 255),
8686
) -> None: ...
8787
def draw_quad(
8888
self,
89-
p1_xy: Coordinate,
90-
p2_xy: Coordinate,
91-
p3_xy: Coordinate,
92-
p4_xy: Coordinate,
93-
p1_uv: Coordinate = (0.0, 0.0),
94-
p2_uv: Coordinate = (1.0, 0.0),
95-
p3_uv: Coordinate = (1.0, 1.0),
96-
p4_uv: Coordinate = (0.0, 1.0),
89+
p1_xy: Point,
90+
p2_xy: Point,
91+
p3_xy: Point,
92+
p4_xy: Point,
93+
p1_uv: Point = (0.0, 0.0),
94+
p2_uv: Point = (1.0, 0.0),
95+
p3_uv: Point = (1.0, 1.0),
96+
p4_uv: Point = (0.0, 1.0),
9797
p1_mod: Iterable[int] = (255, 255, 255, 255),
9898
p2_mod: Iterable[int] = (255, 255, 255, 255),
9999
p3_mod: Iterable[int] = (255, 255, 255, 255),
@@ -155,21 +155,21 @@ class Renderer:
155155
area: Optional[RectLike] = None,
156156
special_flags: int = 0,
157157
) -> Rect: ...
158-
def draw_line(self, p1: Coordinate, p2: Coordinate) -> None: ...
159-
def draw_point(self, point: Coordinate) -> None: ...
158+
def draw_line(self, p1: Point, p2: Point) -> None: ...
159+
def draw_point(self, point: Point) -> None: ...
160160
def draw_rect(self, rect: RectLike) -> None: ...
161161
def fill_rect(self, rect: RectLike) -> None: ...
162162
def draw_triangle(
163-
self, p1: Coordinate, p2: Coordinate, p3: Coordinate
163+
self, p1: Point, p2: Point, p3: Point
164164
) -> None: ...
165165
def fill_triangle(
166-
self, p1: Coordinate, p2: Coordinate, p3: Coordinate
166+
self, p1: Point, p2: Point, p3: Point
167167
) -> None: ...
168168
def draw_quad(
169-
self, p1: Coordinate, p2: Coordinate, p3: Coordinate, p4: Coordinate
169+
self, p1: Point, p2: Point, p3: Point, p4: Point
170170
) -> None: ...
171171
def fill_quad(
172-
self, p1: Coordinate, p2: Coordinate, p3: Coordinate, p4: Coordinate
172+
self, p1: Point, p2: Point, p3: Point, p4: Point
173173
) -> None: ...
174174
def to_surface(
175175
self, surface: Optional[Surface] = None, area: Optional[RectLike] = None

buildconfig/stubs/pygame/camera.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from abc import ABC, abstractmethod
22
from typing import List, Optional, Tuple, Union, Literal
33

4-
from pygame.typing import IntCoordinate
4+
from pygame.typing import IntPoint
55

66
from pygame.surface import Surface
77

@@ -36,7 +36,7 @@ class Camera(AbstractCamera):
3636
def __init__(
3737
self,
3838
device: Union[str, int] = 0,
39-
size: IntCoordinate = (640, 480),
39+
size: IntPoint = (640, 480),
4040
format: str = "RGB",
4141
) -> None: ...
4242
def start(self) -> None: ...

buildconfig/stubs/pygame/cursors.pyi

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from typing import Any, Iterator, Literal, Tuple, Union, overload
22

33
from pygame.surface import Surface
44

5-
from pygame.typing import FileLike, IntCoordinate, SequenceLike
5+
from pygame.typing import FileLike, IntPoint, SequenceLike
66

77
_Small_string = Tuple[
88
str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str
@@ -64,15 +64,15 @@ class Cursor:
6464
@overload
6565
def __init__(
6666
self,
67-
size: IntCoordinate,
68-
hotspot: IntCoordinate,
67+
size: IntPoint,
68+
hotspot: IntPoint,
6969
xormasks: SequenceLike[int],
7070
andmasks: SequenceLike[int],
7171
) -> None: ...
7272
@overload
7373
def __init__(
7474
self,
75-
hotspot: IntCoordinate,
75+
hotspot: IntPoint,
7676
surface: Surface,
7777
) -> None: ...
7878
def __iter__(self) -> Iterator[Any]: ...
@@ -81,11 +81,11 @@ class Cursor:
8181
def __hash__(self) -> int: ...
8282
def __getitem__(
8383
self, index: int
84-
) -> Union[int, IntCoordinate, Surface]: ...
84+
) -> Union[int, IntPoint, Surface]: ...
8585
def copy(self) -> Cursor: ...
8686
type: Literal["system", "color", "bitmap"]
8787
data: Union[
8888
Tuple[int],
8989
Tuple[Tuple[int, int], Tuple[int, int], Tuple[int, ...], Tuple[int, ...]],
90-
Tuple[IntCoordinate, Surface],
90+
Tuple[IntPoint, Surface],
9191
]

buildconfig/stubs/pygame/display.pyi

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ from pygame._sdl2 import Window
88

99
from pygame.typing import (
1010
ColorLike,
11-
Coordinate,
12-
IntCoordinate,
11+
Point,
12+
IntPoint,
1313
RectLike,
1414
SequenceLike,
1515
)
@@ -37,7 +37,7 @@ def init() -> None: ...
3737
def quit() -> None: ...
3838
def get_init() -> bool: ...
3939
def set_mode(
40-
size: Coordinate = (0, 0),
40+
size: Point = (0, 0),
4141
flags: int = 0,
4242
depth: int = 0,
4343
display: int = 0,
@@ -52,7 +52,7 @@ def update(
5252
@overload
5353
def update(x: int, y: int, w: int, h: int, /) -> None: ...
5454
@overload
55-
def update(xy: Coordinate, wh: Coordinate, /) -> None: ...
55+
def update(xy: Point, wh: Point, /) -> None: ...
5656
def get_driver() -> str: ...
5757
def Info() -> _VidInfo: ...
5858
def get_wm_info() -> Dict[str, int]: ...
@@ -62,7 +62,7 @@ def list_modes(
6262
display: int = 0,
6363
) -> List[Tuple[int, int]]: ...
6464
def mode_ok(
65-
size: IntCoordinate,
65+
size: IntPoint,
6666
flags: int = 0,
6767
depth: int = 0,
6868
display: int = 0,
@@ -85,7 +85,7 @@ def set_palette(palette: SequenceLike[ColorLike], /) -> None: ...
8585
def get_num_displays() -> int: ...
8686
def get_window_size() -> Tuple[int, int]: ...
8787
def get_window_position() -> Tuple[int, int]:...
88-
def set_window_position(position: Coordinate) -> None:...
88+
def set_window_position(position: Point) -> None:...
8989
def get_allow_screensaver() -> bool: ...
9090
def set_allow_screensaver(value: bool = True) -> None: ...
9191
def get_desktop_sizes() -> List[Tuple[int, int]]: ...

buildconfig/stubs/pygame/draw.pyi

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from pygame.rect import Rect
22
from pygame.surface import Surface
33
from typing import overload
44

5-
from pygame.typing import ColorLike, Coordinate, RectLike, SequenceLike
5+
from pygame.typing import ColorLike, Point, RectLike, SequenceLike
66

77
def rect(
88
surface: Surface,
@@ -18,13 +18,13 @@ def rect(
1818
def polygon(
1919
surface: Surface,
2020
color: ColorLike,
21-
points: SequenceLike[Coordinate],
21+
points: SequenceLike[Point],
2222
width: int = 0,
2323
) -> Rect: ...
2424
def circle(
2525
surface: Surface,
2626
color: ColorLike,
27-
center: Coordinate,
27+
center: Point,
2828
radius: float,
2929
width: int = 0,
3030
draw_top_right: bool = False,
@@ -36,15 +36,15 @@ def circle(
3636
def aacircle(
3737
surface: Surface,
3838
color: ColorLike,
39-
center: Coordinate,
39+
center: Point,
4040
radius: float,
4141
width: int = 0,
4242
) -> Rect: ...
4343
@overload
4444
def aacircle(
4545
surface: Surface,
4646
color: ColorLike,
47-
center: Coordinate,
47+
center: Point,
4848
radius: float,
4949
width: int = 0,
5050
draw_top_right: bool = False,
@@ -66,26 +66,26 @@ def arc(
6666
def line(
6767
surface: Surface,
6868
color: ColorLike,
69-
start_pos: Coordinate,
70-
end_pos: Coordinate,
69+
start_pos: Point,
70+
end_pos: Point,
7171
width: int = 1,
7272
) -> Rect: ...
7373
def lines(
7474
surface: Surface,
7575
color: ColorLike,
7676
closed: bool,
77-
points: SequenceLike[Coordinate],
77+
points: SequenceLike[Point],
7878
width: int = 1,
7979
) -> Rect: ...
8080
def aaline(
8181
surface: Surface,
8282
color: ColorLike,
83-
start_pos: Coordinate,
84-
end_pos: Coordinate,
83+
start_pos: Point,
84+
end_pos: Point,
8585
) -> Rect: ...
8686
def aalines(
8787
surface: Surface,
8888
color: ColorLike,
8989
closed: bool,
90-
points: SequenceLike[Coordinate],
90+
points: SequenceLike[Point],
9191
) -> Rect: ...

buildconfig/stubs/pygame/geometry.pyi

+17-17
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ from typing import (
99
)
1010

1111
from pygame import Rect, FRect
12-
from pygame.typing import Coordinate, RectLike, SequenceLike
12+
from pygame.typing import Point, RectLike, SequenceLike
1313
from .rect import Rect, FRect
1414
from .math import Vector2
1515

16-
_CanBeCircle = Union[Circle, Tuple[Coordinate, float], SequenceLike[float]]
16+
_CanBeCircle = Union[Circle, Tuple[Point, float], SequenceLike[float]]
1717

1818
class _HasCirclettribute(Protocol):
1919
# An object that has a circle attribute that is either a circle, or a function
2020
# that returns a circle
2121
circle: Union[_CanBeCircle, Callable[[], _CanBeCircle]]
2222

2323
_CircleValue = Union[_CanBeCircle, _HasCirclettribute]
24-
_CanBeCollided = Union[Circle, Rect, FRect, Coordinate, Vector2]
24+
_CanBeCollided = Union[Circle, Rect, FRect, Point, Vector2]
2525
_CanBeIntersected = Union[Circle]
2626

2727
class Circle:
@@ -64,53 +64,53 @@ class Circle:
6464
@property
6565
def center(self) -> Tuple[float, float]: ...
6666
@center.setter
67-
def center(self, value: Coordinate) -> None: ...
67+
def center(self, value: Point) -> None: ...
6868
@property
6969
def top(self) -> Tuple[float, float]: ...
7070
@top.setter
71-
def top(self, value: Coordinate) -> None: ...
71+
def top(self, value: Point) -> None: ...
7272
@property
7373
def left(self) -> Tuple[float, float]: ...
7474
@left.setter
75-
def left(self, value: Coordinate) -> None: ...
75+
def left(self, value: Point) -> None: ...
7676
@property
7777
def bottom(self) -> Tuple[float, float]: ...
7878
@bottom.setter
79-
def bottom(self, value: Coordinate) -> None: ...
79+
def bottom(self, value: Point) -> None: ...
8080
@property
8181
def right(self) -> Tuple[float, float]: ...
8282
@right.setter
83-
def right(self, value: Coordinate) -> None: ...
83+
def right(self, value: Point) -> None: ...
8484
@overload
8585
def __init__(self, x: float, y: float, r: float) -> None: ...
8686
@overload
87-
def __init__(self, pos: Coordinate, r: float) -> None: ...
87+
def __init__(self, pos: Point, r: float) -> None: ...
8888
@overload
8989
def __init__(self, circle: _CircleValue) -> None: ...
9090
@overload
9191
def move(self, x: float, y: float, /) -> Circle: ...
9292
@overload
93-
def move(self, move_by: Coordinate, /) -> Circle: ...
93+
def move(self, move_by: Point, /) -> Circle: ...
9494
@overload
9595
def move_ip(self, x: float, y: float, /) -> None: ...
9696
@overload
97-
def move_ip(self, move_by: Coordinate, /) -> None: ...
97+
def move_ip(self, move_by: Point, /) -> None: ...
9898
@overload
9999
def collidepoint(self, x: float, y: float, /) -> bool: ...
100100
@overload
101-
def collidepoint(self, point: Coordinate, /) -> bool: ...
101+
def collidepoint(self, point: Point, /) -> bool: ...
102102
@overload
103103
def collidecircle(self, circle: _CircleValue, /) -> bool: ...
104104
@overload
105105
def collidecircle(self, x: float, y: float, r: float, /) -> bool: ...
106106
@overload
107-
def collidecircle(self, center: Coordinate, r: float, /) -> bool: ...
107+
def collidecircle(self, center: Point, r: float, /) -> bool: ...
108108
@overload
109109
def colliderect(self, rect: RectLike, /) -> bool: ...
110110
@overload
111111
def colliderect(self, x: float, y: float, w: float, h: float, /) -> bool: ...
112112
@overload
113-
def colliderect(self, topleft: Coordinate, size: Coordinate, /) -> bool: ...
113+
def colliderect(self, topleft: Point, size: Point, /) -> bool: ...
114114
def collideswith(self, other: _CanBeCollided, /) -> bool: ...
115115
def collidelist(self, colliders: Sequence[_CanBeCollided], /) -> int: ...
116116
def collidelistall(self, colliders: Sequence[_CanBeCollided], /) -> List[int]: ...
@@ -121,13 +121,13 @@ class Circle:
121121
@overload
122122
def update(self, x: float, y: float, r: float, /) -> None: ...
123123
@overload
124-
def update(self, center: Coordinate, r: float, /) -> None: ...
124+
def update(self, center: Point, r: float, /) -> None: ...
125125
@overload
126-
def rotate(self, angle: float, rotation_point: Coordinate, /) -> Circle: ...
126+
def rotate(self, angle: float, rotation_point: Point, /) -> Circle: ...
127127
@overload
128128
def rotate(self, angle: float, /) -> Circle: ...
129129
@overload
130-
def rotate_ip(self, angle: float, rotation_point: Coordinate, /) -> None: ...
130+
def rotate_ip(self, angle: float, rotation_point: Point, /) -> None: ...
131131
@overload
132132
def rotate_ip(self, angle: float, /) -> None: ...
133133
def as_rect(self) -> Rect: ...

buildconfig/stubs/pygame/gfxdraw.pyi

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pygame.surface import Surface
22

3-
from pygame.typing import ColorLike, Coordinate, RectLike, SequenceLike
3+
from pygame.typing import ColorLike, Point, RectLike, SequenceLike
44

55
def pixel(surface: Surface, x: int, y: int, color: ColorLike, /) -> None: ...
66
def hline(surface: Surface, x1: int, x2: int, y: int, color: ColorLike, /) -> None: ...
@@ -73,17 +73,17 @@ def filled_trigon(
7373
color: ColorLike, /
7474
) -> None: ...
7575
def polygon(
76-
surface: Surface, points: SequenceLike[Coordinate], color: ColorLike, /
76+
surface: Surface, points: SequenceLike[Point], color: ColorLike, /
7777
) -> None: ...
7878
def aapolygon(
79-
surface: Surface, points: SequenceLike[Coordinate], color: ColorLike, /
79+
surface: Surface, points: SequenceLike[Point], color: ColorLike, /
8080
) -> None: ...
8181
def filled_polygon(
82-
surface: Surface, points: SequenceLike[Coordinate], color: ColorLike, /
82+
surface: Surface, points: SequenceLike[Point], color: ColorLike, /
8383
) -> None: ...
8484
def textured_polygon(
85-
surface: Surface, points: SequenceLike[Coordinate], texture: Surface, tx: int, ty: int, /
85+
surface: Surface, points: SequenceLike[Point], texture: Surface, tx: int, ty: int, /
8686
) -> None: ...
8787
def bezier(
88-
surface: Surface, points: SequenceLike[Coordinate], steps: int, color: ColorLike, /
88+
surface: Surface, points: SequenceLike[Point], steps: int, color: ColorLike, /
8989
) -> None: ...

0 commit comments

Comments
 (0)