Skip to content
Merged
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
39 changes: 29 additions & 10 deletions arcade/sprite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1416,12 +1416,19 @@ def load_animated_gif(resource_name) -> AnimatedTimeBasedSprite:

class SpriteSolidColor(Sprite):
"""
This sprite is just a rectangular sprite of one solid color. No need to
use an image file.
A rectangular sprite of the given ``width``, ``height``, and ``color``.

:param int width: Width of the sprite
:param int height: Height of the sprite
:param Color color: Color of the sprite
The texture is automatically generated instead of loaded from a
file.

There may be a stutter the first time a combination of ``width``,
``height``, and ``color`` is used due to texture generation. All
subsequent calls for the same combination will run faster because
they will re-use the texture generated earlier.

:param int width: Width of the sprite in pixels
:param int height: Height of the sprite in pixels
:param Color color: The color of the sprite as an RGB or RGBA tuple
"""
def __init__(self, width: int, height: int, color: Color):
"""
Expand All @@ -1447,12 +1454,24 @@ def __init__(self, width: int, height: int, color: Color):

class SpriteCircle(Sprite):
"""
This sprite is just an elliptical sprite of one solid color. No need to
use an image file.
A circle of the specified `radius <https://simple.wikipedia.org/wiki/Radius>`_.

The texture is automatically generated instead of loaded from a
file.

There may be a stutter the first time a combination of ``radius``,
``color``, and ``soft`` is used due to texture generation. All
subsequent calls for the same combination will run faster because
they will re-use the texture generated earlier.

For a gradient fill instead of a solid color, set ``soft`` to
``True``. The circle will fade from an opaque center to transparent
at the edges.

:param float radius: Radius of the circle
:param Color color: Color of the circle
:param bool soft: If True, will add a alpha gradient
:param int radius: Radius of the circle in pixels
:param Color color: The Color of the sprite as an RGB or RGBA tuple
:param bool soft: If ``True``, the circle will fade from an opaque
center to transparent edges.
"""
def __init__(self, radius: int, color: Color, soft: bool = False):
super().__init__()
Expand Down