Skip to content

Commit 3c17eca

Browse files
authored
Small docs and example cleanup (#2546)
1 parent 1ee0d89 commit 3c17eca

7 files changed

Lines changed: 34 additions & 27 deletions

File tree

arcade/context.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ def load_texture(
495495
internal_format (optional):
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):
499+
Make the storage (not the contents) immutable. This can sometimes be
500+
required when using textures with compute shaders.
498501
compressed (optional):
499502
If the internal format is a compressed format meaning your
500503
texture will be compressed by the GPU.

arcade/examples/light_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self):
4747
self.physics_engine = None
4848

4949
# Camera
50-
self.cam: arcade.camera.Camera2D = None
50+
self.camera: arcade.camera.Camera2D = None
5151

5252
# --- Light related ---
5353
# List of all the lights

arcade/examples/line_of_sight.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -120,31 +120,27 @@ def on_draw(self):
120120
"""
121121
Render the screen.
122122
"""
123-
try:
124-
# This command has to happen before we start drawing
125-
self.clear()
126-
127-
# Draw all the sprites.
128-
self.player_list.draw()
129-
self.wall_list.draw()
130-
self.enemy_list.draw()
131-
132-
for enemy in self.enemy_list:
133-
if arcade.has_line_of_sight(
134-
self.player.position, enemy.position, self.wall_list
135-
):
136-
color = arcade.color.RED
137-
else:
138-
color = arcade.color.WHITE
139-
arcade.draw_line(self.player.center_x,
140-
self.player.center_y,
141-
enemy.center_x,
142-
enemy.center_y,
143-
color,
144-
2)
145-
146-
except Exception as e:
147-
print(e)
123+
# This command has to happen before we start drawing
124+
self.clear()
125+
126+
# Draw all the sprites.
127+
self.player_list.draw()
128+
self.wall_list.draw()
129+
self.enemy_list.draw()
130+
131+
for enemy in self.enemy_list:
132+
if arcade.has_line_of_sight(
133+
self.player.position, enemy.position, self.wall_list
134+
):
135+
color = arcade.color.RED
136+
else:
137+
color = arcade.color.WHITE
138+
arcade.draw_line(self.player.center_x,
139+
self.player.center_y,
140+
enemy.center_x,
141+
enemy.center_y,
142+
color,
143+
2)
148144

149145
def on_update(self, delta_time):
150146
""" Movement and game logic """

arcade/experimental/shadertoy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ def render(
278278
Override the size
279279
frame:
280280
Override frame
281+
frame_rate:
282+
Override frame_rate
281283
"""
282284
self._time = time if time is not None else self._time
283285
self._time_delta = time_delta if time_delta is not None else self._time_delta

arcade/texture/spritesheet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ def get_texture(
147147
hit_box_algorithm:
148148
Hit box algorithm to use for the texture.
149149
If not provided, the default hit box algorithm will be used.
150+
y_up:
151+
Sets the coordinate space of the image to assert (0, 0)
152+
in the bottom left.
150153
"""
151154
im = self.get_image(rect, y_up)
152155
texture = Texture(im, hit_box_algorithm=hit_box_algorithm)

arcade/tilemap/tilemap.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,9 @@ def load_tilemap(
10621062
Can be used to offset the position of all sprites and objects
10631063
within the map. This will be applied in addition to any offsets from Tiled. This value
10641064
can be overridden with the layer_options dict.
1065+
texture_atlas:
1066+
A default texture atlas to use for the SpriteLists created by this map.
1067+
If not supplied the global default atlas will be used.
10651068
lazy:
10661069
SpriteLists will be created lazily.
10671070
"""

doc/tutorials/platform_tutorial/step_12.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ at this stage is ready for drawing and we don't need to do anything else to it(o
8989
``layer_options`` is a special dictionary that can be provided to the ``load_tilemap`` function. This will
9090
send special options for each layer into the map loader. In this example our map has a layer called
9191
``Platforms``, and we want to enable spatial hashing on it. Much like we did for our ``wall`` SpriteList
92-
before. For more info on the layer options dictionary and the available keys, check out :class`arcade.TileMap`
92+
before. For more info on the layer options dictionary and the available keys, check out :class:`arcade.TileMap`
9393

9494
At this point we only have one piece of code left to change. In switching to our new map, you may have noticed by
9595
the ``layer_options`` dictionary that we now have a layer named ``Platforms``. Previously in our Scene we were calling

0 commit comments

Comments
 (0)