Skip to content

Commit

Permalink
feat(gui): improve rotation support in UIImage (#2401)
Browse files Browse the repository at this point in the history
  • Loading branch information
eruvanos authored Oct 10, 2024
1 parent 4f4028b commit bec1d64
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arcade/gui/widgets/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ class UIImage(UIWidget):
If no size given, the texture size is used.
The UIImage supports rotation and alpha values, which only apply to the texture.
Border, and background color are not affected by this.
The size of the image is reduced when rotated to stay within bounce of the widget.
Args:
texture: Texture to show
width: width of widget
height: height of widget
angle: angle of the texture in degrees
alpha: alpha value of the texture, value between 0 and 255
**kwargs: passed to UIWidget
"""

Expand All @@ -39,9 +45,13 @@ def __init__(
texture: Union[Texture, NinePatchTexture],
width: float | None = None,
height: float | None = None,
angle: int = 0,
alpha: int = 255,
**kwargs,
):
self.texture = texture
self.angle = angle
self.alpha = alpha

super().__init__(
width=width if width else texture.width,
Expand Down

0 comments on commit bec1d64

Please sign in to comment.