tuxemon.compat.rect module
- class tuxemon.compat.rect.HasRectAttribute(*args, **kwargs)[source]
Bases:
Protocol[RectType]- property rect: RectType
- class tuxemon.compat.rect.ReadOnlyRect(*args, **kwargs)[source]
Bases:
ProtocolInterface of a PyGame compatible rect.
- property bottom: int
- property bottomleft: Tuple[int, int]
- property bottomright: Tuple[int, int]
- property center: Tuple[int, int]
- property centerx: int
- property centery: int
- collidelist(_ReadOnlyRect__rects)[source]
- Parameters:
self (SelfRectType) –
_ReadOnlyRect__rects (Sequence[SelfRectType | Tuple[int, int, int, int] | Tuple[Tuple[int, int], Tuple[int, int]]]) –
- Return type:
int
- collidelistall(_ReadOnlyRect__l)[source]
- Parameters:
self (SelfRectType) –
_ReadOnlyRect__l (Sequence[SelfRectType | Tuple[int, int, int, int] | Tuple[Tuple[int, int], Tuple[int, int]]]) –
- Return type:
Sequence[int]
- collidepoint(_ReadOnlyRect__point)[source]
- Parameters:
_ReadOnlyRect__point (Tuple[int, int]) –
- Return type:
bool
- colliderect(_ReadOnlyRect__other)[source]
- Parameters:
self (SelfRectType) –
_ReadOnlyRect__other (SelfRectType | Tuple[int, int, int, int] | Tuple[Tuple[int, int], Tuple[int, int]]) –
- Return type:
bool
- contains(_ReadOnlyRect__other)[source]
- Parameters:
self (SelfRectType) –
_ReadOnlyRect__other (SelfRectType | Tuple[int, int, int, int] | Tuple[Tuple[int, int], Tuple[int, int]]) –
- Return type:
bool
- abstract property h: int
- property height: int
- inflate(x, y)[source]
- Parameters:
self (SelfRectType) –
x (int) –
y (int) –
- Return type:
SelfRectType
- property left: int
- property midbottom: Tuple[int, int]
- property midleft: Tuple[int, int]
- property midright: Tuple[int, int]
- property midtop: Tuple[int, int]
- property right: int
- property size: Tuple[int, int]
- property top: int
- property topleft: Tuple[int, int]
- property topright: Tuple[int, int]
- union(_ReadOnlyRect__other)[source]
- Parameters:
self (SelfRectType) –
_ReadOnlyRect__other (SelfRectType | Tuple[int, int, int, int] | Tuple[Tuple[int, int], Tuple[int, int]]) –
- Return type:
SelfRectType
- unionall(_ReadOnlyRect__rects)[source]
- Parameters:
self (SelfRectType) –
_ReadOnlyRect__rects (Sequence[SelfRectType | Tuple[int, int, int, int] | Tuple[Tuple[int, int], Tuple[int, int]]]) –
- Return type:
SelfRectType
- abstract property w: int
- property width: int
- abstract property x: int
- abstract property y: int
- class tuxemon.compat.rect.Rect(arg)[source]
Bases:
ReadOnlyRectPure Python Rect class that follows the PyGame API
- GIANT WARNING: This is completely in python and will be much slower than
PyGame’s built in Rect class. This rect should be used only if needed!
These rects support floating point and are hashable.
- property h: int
- property w: int
- property x: int
- property y: int
- tuxemon.compat.rect.intersect(r1, r2)[source]
- Parameters:
r1 (ReadOnlyRect) –
r2 (ReadOnlyRect) –
- Return type:
bool