diff --git a/arcade/scene.py b/arcade/scene.py index d9063b4027..dac305ec7b 100644 --- a/arcade/scene.py +++ b/arcade/scene.py @@ -16,7 +16,7 @@ from arcade import Sprite, SpriteList from arcade.gl.types import BlendFunction, OpenGlFilter from arcade.tilemap import TileMap -from arcade.types import RGBA255, Color +from arcade.types import Color, RGBOrA255 __all__ = ["Scene", "SceneKeyError"] @@ -499,7 +499,7 @@ def draw( def draw_hit_boxes( self, - color: RGBA255 = Color(0, 0, 0, 255), + color: RGBOrA255 = Color(0, 0, 0, 255), line_thickness: float = 1.0, names: Iterable[str] | None = None, ) -> None: diff --git a/arcade/sprite/base.py b/arcade/sprite/base.py index c4a5a75872..d07dc7c9c1 100644 --- a/arcade/sprite/base.py +++ b/arcade/sprite/base.py @@ -7,7 +7,7 @@ from arcade.exceptions import ReplacementWarning, warning from arcade.hitbox import HitBox from arcade.texture import Texture -from arcade.types import LRBT, RGBA255, AsFloat, Color, Point, Point2, Point2List, Rect, RGBOrA255 +from arcade.types import LRBT, AsFloat, Color, Point, Point2, Point2List, Rect, RGBOrA255 from arcade.utils import copy_dunders_unimplemented if TYPE_CHECKING: @@ -764,7 +764,7 @@ def remove_from_sprite_lists(self) -> None: # ----- Drawing Methods ----- - def draw_hit_box(self, color: RGBA255 = BLACK, line_thickness: float = 2.0) -> None: + def draw_hit_box(self, color: RGBOrA255 = BLACK, line_thickness: float = 2.0) -> None: """ Draw a sprite's hit-box. This is useful for debugging. @@ -774,10 +774,11 @@ def draw_hit_box(self, color: RGBA255 = BLACK, line_thickness: float = 2.0) -> N line_thickness: How thick the box should be """ + converted_color = Color.from_iterable(color) points: Point2List = self.hit_box.get_adjusted_points() # NOTE: This is a COPY operation. We don't want to modify the points. points = tuple(points) + tuple(points[:-1]) - arcade.draw_line_strip(points, color=color, line_width=line_thickness) + arcade.draw_line_strip(points, color=converted_color, line_width=line_thickness) # ---- Shortcut Methods ----