Skip to content

Commit da666de

Browse files
committed
fix(arcade): fix mix of fade and alpha
1 parent 6c5686a commit da666de

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

arcade/gui/experimental/splash.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
"""
2+
An experimental splash screen for arcade.
3+
4+
This is a simple splash screen that shows the arcade logo for a few seconds before the actual game starts.
5+
6+
If arcade is properly installed, you can run this script with:
7+
python -m arcade.gui.experimental.splash
8+
"""
9+
110
import arcade
211
from arcade import View
312
from arcade.gui import UIView, UIAnchorLayout, UIImage, UILabel, UIBoxLayout
@@ -35,7 +44,6 @@ def on_update(self, delta_time: float):
3544

3645
# fade in arcade logo
3746
self._logo.alpha = min(255, int(255 * self._time / self.duration))
38-
print(self._logo.alpha)
3947

4048

4149
if __name__ == "__main__":

arcade/gui/surface.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,14 @@ def draw_texture(
131131
"""
132132
if isinstance(tex, NinePatchTexture):
133133
if angle != 0.0:
134-
raise NotImplementedError(
135-
f"Ninepatch does not support an angle != 0 yet, but got {angle}"
136-
)
134+
raise NotImplementedError(f"Ninepatch does not support an angle != 0 yet, but got {angle}")
137135

138136
if alpha != 255:
139-
raise NotImplementedError(
140-
f"Ninepatch does not support an alpha != 255 yet, but got {alpha}"
141-
)
137+
raise NotImplementedError(f"Ninepatch does not support an alpha != 255 yet, but got {alpha}")
142138

143139
tex.draw_rect(rect=LBWH(0, 0, width, height))
144140
else:
145-
arcade.draw_texture_rect(tex, LBWH(x, y, width, height), angle=angle, alpha=alpha)
141+
arcade.draw_texture_rect(tex, LBWH(x, y, width, height), angle=angle, fade=alpha / 255)
146142

147143
def draw_sprite(self, x: float, y: float, width: float, height: float, sprite: arcade.Sprite):
148144
"""Draw a sprite to the surface

0 commit comments

Comments
 (0)