Skip to content

Small docs and example cleanup #2546

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

Merged
merged 1 commit into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions arcade/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ def load_texture(
internal_format (optional):
The internal format of the texture. This can be used to override
the default internal format when using sRGBA or compressed textures.
immutable (optional):
Make the storage (not the contents) immutable. This can sometimes be
required when using textures with compute shaders.
compressed (optional):
If the internal format is a compressed format meaning your
texture will be compressed by the GPU.
Expand Down
2 changes: 1 addition & 1 deletion arcade/examples/light_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self):
self.physics_engine = None

# Camera
self.cam: arcade.camera.Camera2D = None
self.camera: arcade.camera.Camera2D = None

# --- Light related ---
# List of all the lights
Expand Down
46 changes: 21 additions & 25 deletions arcade/examples/line_of_sight.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,31 +120,27 @@ def on_draw(self):
"""
Render the screen.
"""
try:
# This command has to happen before we start drawing
self.clear()

# Draw all the sprites.
self.player_list.draw()
self.wall_list.draw()
self.enemy_list.draw()

for enemy in self.enemy_list:
if arcade.has_line_of_sight(
self.player.position, enemy.position, self.wall_list
):
color = arcade.color.RED
else:
color = arcade.color.WHITE
arcade.draw_line(self.player.center_x,
self.player.center_y,
enemy.center_x,
enemy.center_y,
color,
2)

except Exception as e:
print(e)
# This command has to happen before we start drawing
self.clear()

# Draw all the sprites.
self.player_list.draw()
self.wall_list.draw()
self.enemy_list.draw()

for enemy in self.enemy_list:
if arcade.has_line_of_sight(
self.player.position, enemy.position, self.wall_list
):
color = arcade.color.RED
else:
color = arcade.color.WHITE
arcade.draw_line(self.player.center_x,
self.player.center_y,
enemy.center_x,
enemy.center_y,
color,
2)

def on_update(self, delta_time):
""" Movement and game logic """
Expand Down
2 changes: 2 additions & 0 deletions arcade/experimental/shadertoy.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ def render(
Override the size
frame:
Override frame
frame_rate:
Override frame_rate
"""
self._time = time if time is not None else self._time
self._time_delta = time_delta if time_delta is not None else self._time_delta
Expand Down
3 changes: 3 additions & 0 deletions arcade/texture/spritesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ def get_texture(
hit_box_algorithm:
Hit box algorithm to use for the texture.
If not provided, the default hit box algorithm will be used.
y_up:
Sets the coordinate space of the image to assert (0, 0)
in the bottom left.
"""
im = self.get_image(rect, y_up)
texture = Texture(im, hit_box_algorithm=hit_box_algorithm)
Expand Down
3 changes: 3 additions & 0 deletions arcade/tilemap/tilemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,9 @@ def load_tilemap(
Can be used to offset the position of all sprites and objects
within the map. This will be applied in addition to any offsets from Tiled. This value
can be overridden with the layer_options dict.
texture_atlas:
A default texture atlas to use for the SpriteLists created by this map.
If not supplied the global default atlas will be used.
lazy:
SpriteLists will be created lazily.
"""
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/platform_tutorial/step_12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ at this stage is ready for drawing and we don't need to do anything else to it(o
``layer_options`` is a special dictionary that can be provided to the ``load_tilemap`` function. This will
send special options for each layer into the map loader. In this example our map has a layer called
``Platforms``, and we want to enable spatial hashing on it. Much like we did for our ``wall`` SpriteList
before. For more info on the layer options dictionary and the available keys, check out :class`arcade.TileMap`
before. For more info on the layer options dictionary and the available keys, check out :class:`arcade.TileMap`

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