Skip to content

Commit cdeed03

Browse files
einarfpushfoo
andauthored
Fix broken references in docs: First pass (#2616)
* Enable nitpicky mode * Sound.source was never exposed in docs * Fix broken refs in sound manual * Fix performance_tips * Fix gui docs * Fix event_loop * arcade.gl: Remove optional markers in docstrings * gl module fixes * Remove optional annotations in napoleon docstrings * Camera fixes * Fix a loose reference to pyglet.math.Vec3 by prefixing the full path * More doc fixes * Missing docstrings in camera module * More fixes * Disable nitpicky --------- Co-authored-by: pushfoo <[email protected]>
1 parent 94f1d57 commit cdeed03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+350
-256
lines changed

CONTRIBUTING.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The minium for docstrings is covering all parameters in an `Args:` block.
103103
Args:
104104
width: The width of something
105105
height: The height of something
106-
title (optional): The title of something
106+
title: The title of something
107107
```
108108

109109
* `Args:` should be used for all parameters
@@ -115,7 +115,6 @@ Args:
115115
* `Attributes:` we should try to avoid it and instead document the attributes in the code
116116
* Types are visible in the api docs. It's not mandatory to include types in docstring,
117117
however, simple types like `int`, `str`, `float`, `bool` can be included.
118-
* Using `optional` is a good way to indicate that a parameter is optional.
119118
* Properties and attribute docs don't need a type when this is already clear from
120119
type or return annotation.
121120

arcade/application.py

+32-32
Original file line numberDiff line numberDiff line change
@@ -86,51 +86,51 @@ class Window(pyglet.window.Window):
8686
.. _pyglet_pg_window_style: https://pyglet.readthedocs.io/en/latest/programming_guide/windowing.html#window-style
8787
8888
Args:
89-
width (optional):
89+
width:
9090
Window width. Defaults to 1280.
91-
height (optional):
91+
height:
9292
Window height. Defaults to 720.
93-
title (optional):
93+
title:
9494
The title/caption of the window
95-
fullscreen (optional):
95+
fullscreen:
9696
Should this be full screen?
97-
resizable (optional):
97+
resizable:
9898
Can the user resize the window?
99-
update_rate (optional):
99+
update_rate:
100100
How frequently to run the on_update event.
101-
draw_rate (optional):
101+
draw_rate:
102102
How frequently to run the on_draw event. (this is the FPS limit)
103-
fixed_rate (optional):
103+
fixed_rate:
104104
How frequently should the fixed_updates run,
105105
fixed updates will always run at this rate.
106-
fixed_frame_cap (optional):
106+
fixed_frame_cap:
107107
The maximum number of fixed updates that can occur in one update loop.
108108
defaults to infinite. If large lag spikes cause your game to freeze,
109109
try setting this to a smaller number. This may cause your physics to
110110
lag behind temporarily.
111-
antialiasing (optional):
111+
antialiasing:
112112
Use multisampling framebuffer (antialiasing)
113113
samples: Number of samples used in antialiasing (default 4).
114114
Usually this is 2, 4, 8 or 16.
115-
gl_version (optional): What OpenGL version to request.
115+
gl_version: What OpenGL version to request.
116116
This is ``(3, 3)`` by default and can be overridden when using more
117117
advanced OpenGL features.
118-
screen (optional): Pass a pyglet :py:class:`~pyglet.display.Screen` to
118+
screen: Pass a pyglet :py:class:`~pyglet.display.Screen` to
119119
request the window be placed on it. See `pyglet's window size &
120120
position guide <pyglet_pg_window_size_position_>`_ to learn more.
121-
style (optional): Request a non-default window style, such as borderless.
121+
style: Request a non-default window style, such as borderless.
122122
Some styles only work in certain situations. See `pyglet's guide
123123
to window style <pyglet_pg_window_style_>`_ to learn more.
124-
visible (optional):
124+
visible:
125125
Should the window be visible immediately
126-
vsync (optional):
126+
vsync:
127127
Wait for vertical screen refresh before swapping buffer
128128
This can make animations and movement look smoother.
129-
gc_mode (optional): Decides how OpenGL objects should be garbage collected
129+
gc_mode: Decides how OpenGL objects should be garbage collected
130130
("context_gc" (default) or "auto")
131-
center_window (optional):
131+
center_window:
132132
If true, will center the window.
133-
enable_polling (optional):
133+
enable_polling:
134134
Enabled input polling capability.
135135
This makes the :py:attr:`keyboard` and :py:attr:`mouse` attributes available for use.
136136
@@ -356,17 +356,17 @@ def clear( # type: ignore # not sure what to do here, BaseWindow.clear is stati
356356
set through :py:attr:`~arcade.Window.background_color`.
357357
358358
Args:
359-
color (optional):
359+
color:
360360
Override the current background color with one of the following:
361361
362362
1. A :py:class:`~arcade.types.Color` instance
363363
2. A 3 or 4-length RGB/RGBA :py:class:`tuple` of byte values (0 to 255)
364364
365-
color_normalized (optional):
365+
color_normalized:
366366
override the current background color using normalized values (0.0 to 1.0).
367367
For example, (1.0, 0.0, 0.0, 1.0) making the window contents red.
368368
369-
viewport (optional):
369+
viewport:
370370
The area of the window to clear. By default, the entire window is cleared.
371371
The viewport format is ``(x, y, width, height)``.
372372
"""
@@ -455,19 +455,19 @@ def set_fullscreen(
455455
to the size it was before entering fullscreen mode.
456456
457457
Args:
458-
fullscreen (optional):
458+
fullscreen:
459459
Should we enter or leave fullscreen mode?
460-
screen (optional):
460+
screen:
461461
Which screen should we display on? See :func:`get_screens`
462-
mode (optional):
462+
mode:
463463
The screen will be switched to the given mode. The mode must
464464
have been obtained by enumerating `Screen.get_modes`. If
465465
None, an appropriate mode will be selected from the given
466466
`width` and `height`.
467-
width (optional):
468-
Override the width of the window. Will be rounded to :py:attr:`int`.
469-
height (optional):
470-
Override the height of the window. Will be rounded to :py:attr:`int`.
467+
width:
468+
Override the width of the window. Will be rounded to :py:class:`int`.
469+
height:
470+
Override the height of the window. Will be rounded to :py:class:`int`.
471471
"""
472472
# fmt: off
473473
super().set_fullscreen(
@@ -1280,7 +1280,7 @@ class View:
12801280
and a game over screen. Each of these could be a different view.
12811281
12821282
Args:
1283-
window (optional):
1283+
window:
12841284
The window this view is associated with. If None, the current
12851285
window is used. (Normally you don't need to provide this).
12861286
"""
@@ -1304,15 +1304,15 @@ def clear(
13041304
set through :py:attr:`arcade.View.background_color`.
13051305
13061306
Args:
1307-
color(optional):
1307+
color:
13081308
override the current background color with one of the following:
13091309
13101310
1. A :py:class:`~arcade.types.Color` instance
13111311
2. A 3 or 4-length RGB/RGBA :py:class:`tuple` of byte values (0 to 255)
1312-
color_normalized (optional):
1312+
color_normalized:
13131313
Override the current background color using normalized values (0.0 to 1.0).
13141314
For example, (1.0, 0.0, 0.0, 1.0) making the window contents red.
1315-
viewport (optional):
1315+
viewport:
13161316
The viewport range to clear
13171317
"""
13181318
if color is None and color_normalized is None:

arcade/camera/camera_2d.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ def from_camera_data(
197197
198198
Args:
199199
camera_data:
200-
A :py:class:`~arcade.camera.data.CameraData`
200+
A :py:class:`~arcade.camera.CameraData`
201201
describing the position, up, forward and zoom.
202202
projection_data:
203-
A :py:class:`~arcade.camera.data.OrthographicProjectionData`
203+
A :py:class:`~arcade.camera.OrthographicProjectionData`
204204
which describes the left, right, top, bottom, far, near
205205
planes and the viewport for an orthographic projection.
206206
render_target:
@@ -377,10 +377,10 @@ def match_target(
377377
Sets the viewport to the size of the Camera2D's render target.
378378
379379
Args:
380-
viewport: Flag whether to equalise the viewport to the area of the render target
381-
projection: Flag whether to equalise the size of the projection to
382-
match the render target
383-
The projection center stays fixed, and the new projection matches only in size.
380+
viewport: Flag whether to equalize the viewport to the area of the render target
381+
projection: Flag whether to equalize the size of the projection to
382+
match the render target.
383+
The projection center stays fixed, and the new projection matches only in size.
384384
scissor: Flag whether to update the scissor value.
385385
position: Flag whether to also center the camera to the value.
386386
Off by default
@@ -415,14 +415,14 @@ def update_values(
415415
aspect: float | None = None,
416416
):
417417
"""
418-
Convienence method for updating the viewport, projection, position
418+
Convenience method for updating the viewport, projection, position
419419
and a few others with the same value.
420420
421421
Args:
422422
value: The rect that the values will be derived from.
423-
viewport: Flag whether to equalise the viewport to the value.
424-
projection: Flag whether to equalise the size of the projection to match the value.
425-
The projection center stays fixed, and the new projection matches only in size.
423+
viewport: Flag whether to equalize the viewport to the value.
424+
projection: Flag whether to equalize the size of the projection to match the value.
425+
The projection center stays fixed, and the new projection matches only in size.
426426
scissor: Flag whether to update the scissor value.
427427
position: Flag whether to also center the camera to the value.
428428
Off by default
@@ -456,6 +456,7 @@ def update_values(
456456
def aabb(self) -> Rect:
457457
"""
458458
Retrieve the axis-aligned bounds box of the camera's view area.
459+
459460
If the camera isn't rotated , this will be precisely the view area,
460461
but it will cover a larger area when it is rotated. Useful for CPU culling
461462
"""

arcade/camera/data_types.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,14 @@ def use(self) -> None:
417417
:py:attr:`~arcade.Window.current_camera` to this object
418418
#. Calculate any required view and projection matrices
419419
#. Set any resulting values on the current
420-
:py:class:`~arcade.context.ArcadeContext`, including the:
420+
:py:class:`~arcade.ArcadeContext`, including the:
421421
422-
* :py:attr:`~arcade.context.ArcadeContext.viewport`
423-
* :py:attr:`~arcade.context.ArcadeContext.view_matrix`
424-
* :py:attr:`~arcade.context.ArcadeContext.projection_matrix`
422+
* :py:attr:`~arcade.ArcadeContext.viewport`
423+
* :py:attr:`~arcade.ArcadeContext.view_matrix`
424+
* :py:attr:`~arcade.ArcadeContext.projection_matrix`
425425
426426
This method should **never** handle cleanup. That is the
427427
responsibility of :py:attr:`.activate`.
428-
429428
"""
430429
...
431430

arcade/camera/perspective.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ def generate_projection_matrix(self) -> Mat4:
108108
"""Generates a projection matrix.
109109
110110
This is an alias of
111-
:py:class:`arcade.camera.get_perspective_matrix`.
111+
:py:meth:`generate_perspective_matrix`.
112112
"""
113113
return generate_perspective_matrix(self._projection, self._view.zoom)
114114

115115
def generate_view_matrix(self) -> Mat4:
116116
"""Generates a view matrix.
117117
118118
This is an alias of=
119-
:py:class:`arcade.camera.get_view_matrix`.
119+
:py:meth:`generate_view_matrix`.
120120
"""
121121
return generate_view_matrix(self._view)
122122

@@ -171,7 +171,7 @@ def project(self, world_coordinate: Point) -> Vec2:
171171
"""Convert world coordinates to pixel screen coordinates.
172172
173173
If a 2D :py:class:`~pyglet.math.Vec2` is provided instead of a 3D
174-
:py:class:`Vec3`, then one will be calculated to the best of the
174+
:py:class:`~pyglet.math.Vec3`, then one will be calculated to the best of the
175175
method's ability.
176176
177177
Args:

arcade/camera/projection_functions.py

+36
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ def project_orthographic(
125125
view_matrix: Mat4,
126126
projection_matrix: Mat4,
127127
) -> Vec2:
128+
"""
129+
Project a world coordinate to a screen coordinate using an orthographic projection.
130+
131+
Args:
132+
world_coordinate: The world coordinate to project.
133+
viewport: The viewport of the camera.
134+
view_matrix: The view matrix of the camera.
135+
projection_matrix: The projection matrix of the camera.
136+
"""
128137
x, y, *_z = world_coordinate
129138
z = 0.0 if not _z else _z[0]
130139

@@ -144,6 +153,15 @@ def unproject_orthographic(
144153
view_matrix: Mat4,
145154
projection_matrix: Mat4,
146155
) -> Vec3:
156+
"""
157+
Unproject a screen coordinate to a world coordinate using an orthographic projection.
158+
159+
Args:
160+
screen_coordinate: The screen coordinate to unproject.
161+
viewport: The viewport of the camera.
162+
view_matrix: The view matrix of the camera.
163+
projection_matrix: The projection matrix of the camera.
164+
"""
147165
x, y, *_z = screen_coordinate
148166
z = 0.0 if not _z else _z[0]
149167

@@ -165,6 +183,15 @@ def project_perspective(
165183
view_matrix: Mat4,
166184
projection_matrix: Mat4,
167185
) -> Vec2:
186+
"""
187+
Project a world coordinate to a screen coordinate using a perspective projection.
188+
189+
Args:
190+
world_coordinate: The world coordinate to project.
191+
viewport: The viewport of the camera.
192+
view_matrix: The view matrix of the camera.
193+
projection_matrix: The projection matrix of the camera.
194+
"""
168195
x, y, *_z = world_coordinate
169196
z = 1.0 if not _z else _z[0]
170197

@@ -188,6 +215,15 @@ def unproject_perspective(
188215
view_matrix: Mat4,
189216
projection_matrix: Mat4,
190217
) -> Vec3:
218+
"""
219+
Unproject a screen coordinate to a world coordinate using a perspective projection.
220+
221+
Args:
222+
screen_coordinate: The screen coordinate to unproject.
223+
viewport: The viewport of the camera.
224+
view_matrix: The view matrix of the camera.
225+
projection_matrix: The projection matrix of
226+
"""
191227
x, y, *_z = screen_coordinate
192228
z = 1.0 if not _z else _z[0]
193229

arcade/context.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -358,23 +358,23 @@ def load_program(
358358
Args:
359359
vertex_shader:
360360
Path to the vertex shader.
361-
fragment_shader (optional):
362-
Path to the fragment shader (optional).
363-
geometry_shader (optional):
364-
Path to the geometry shader (optional).
365-
tess_control_shader (optional):
361+
fragment_shader:
362+
Path to the fragment shader.
363+
geometry_shader:
364+
Path to the geometry shader.
365+
tess_control_shader:
366366
Tessellation Control Shader.
367-
tess_evaluation_shader (optional):
367+
tess_evaluation_shader:
368368
Tessellation Evaluation Shader.
369-
common (optional):
369+
common:
370370
Common files to be included in all shaders.
371-
defines (optional):
371+
defines:
372372
Substitute `#define` values in the source.
373-
varyings (optional):
373+
varyings:
374374
The name of the out attributes in a transform shader.
375375
This is normally not necessary since we auto detect them,
376376
but some more complex out structures we can't detect.
377-
varyings_capture_mode (optional):
377+
varyings_capture_mode:
378378
The capture mode for transforms.
379379
380380
Based on these settings, the `transform()` method will accept a single
@@ -435,7 +435,7 @@ def load_compute_shader(
435435
Args:
436436
path:
437437
Path to texture
438-
common (optional):
438+
common:
439439
Common sources injected into compute shader
440440
"""
441441
from arcade.resources import resolve
@@ -492,13 +492,13 @@ def load_texture(
492492
The min and mag filter. Default is ``None``.
493493
build_mipmaps:
494494
Build mipmaps for the texture. Default is ``False``.
495-
internal_format (optional):
495+
internal_format:
496496
The internal format of the texture. This can be used to override
497497
the default internal format when using sRGBA or compressed textures.
498-
immutable (optional):
498+
immutable:
499499
Make the storage (not the contents) immutable. This can sometimes be
500500
required when using textures with compute shaders.
501-
compressed (optional):
501+
compressed:
502502
If the internal format is a compressed format meaning your
503503
texture will be compressed by the GPU.
504504
"""

0 commit comments

Comments
 (0)