|
11 | 11 | from arcade.types.vector_like import AnchorPoint, Point2 |
12 | 12 |
|
13 | 13 | RectParams = tuple[AsFloat, AsFloat, AsFloat, AsFloat] |
14 | | -ViewportParams = tuple[int, int, int, int] |
| 14 | +IntRectParams = tuple[int, int, int, int] |
15 | 15 |
|
16 | 16 |
|
17 | 17 | class RectKwargs(TypedDict): |
@@ -624,10 +624,25 @@ def xyrr(self) -> RectParams: |
624 | 624 | return (self.x, self.y, self.width / 2, self.height / 2) |
625 | 625 |
|
626 | 626 | @property |
627 | | - def viewport(self) -> ViewportParams: |
628 | | - """Provides a tuple in the format of (left, bottom, width, height), coerced to integers.""" |
| 627 | + def lbwh_int(self) -> IntRectParams: |
| 628 | + """Provides a tuple in the format of (left, bottom, width, height), casted to ints.""" |
629 | 629 | return (int(self.left), int(self.bottom), int(self.width), int(self.height)) |
630 | 630 |
|
| 631 | + @property |
| 632 | + def lrbt_int(self) -> IntRectParams: |
| 633 | + """Provides a tuple in the format of (left, right, bottom, top), casted to ints.""" |
| 634 | + return (int(self.left), int(self.right), int(self.bottom), int(self.top)) |
| 635 | + |
| 636 | + @property |
| 637 | + def xywh_int(self) -> IntRectParams: |
| 638 | + """Provides a tuple in the format of (x, y, width, height), casted to ints.""" |
| 639 | + return (int(self.x), int(self.y), int(self.width), int(self.height)) |
| 640 | + |
| 641 | + @property |
| 642 | + def xyrr_int(self) -> RectParams: |
| 643 | + """Provides a tuple in the format of (x, y, width / 2, height / 2), casted to ints.""" |
| 644 | + return (int(self.x), int(self.y), int(self.width) / 2, int(self.height) / 2) |
| 645 | + |
631 | 646 | @classmethod |
632 | 647 | def from_kwargs(cls, **kwargs: AsFloat) -> Rect: |
633 | 648 | """Creates a new Rect from keyword arguments. Throws ValueError if not enough are provided. |
@@ -803,7 +818,7 @@ def Viewport(left: int, bottom: int, width: int, height: int) -> Rect: |
803 | 818 |
|
804 | 819 |
|
805 | 820 | __all__ = [ |
806 | | - "ViewportParams", |
| 821 | + "IntRectParams", |
807 | 822 | "RectParams", |
808 | 823 | "RectKwargs", |
809 | 824 | "Rect", |
|
0 commit comments