From 9f211541df540369cb876b511b00107dd48bccc2 Mon Sep 17 00:00:00 2001 From: adrianna Date: Fri, 9 Sep 2016 22:55:07 +0200 Subject: [PATCH] alpha transform; made seed cursor transparent --- tabakrolletjie/scenes/day.py | 4 ++-- tabakrolletjie/transforms.py | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tabakrolletjie/scenes/day.py b/tabakrolletjie/scenes/day.py index fc79ffc..4af1d8f 100644 --- a/tabakrolletjie/scenes/day.py +++ b/tabakrolletjie/scenes/day.py @@ -11,7 +11,7 @@ from ..obstacles import ObstacleManager from ..events import SceneChangeEvent from ..utils import debug_timer from ..loader import loader -from ..transforms import Overlay, Multiply +from ..transforms import Overlay, Multiply, Alpha from ..constants import SCREEN_SIZE, FONTS from ..widgets import ImageButton @@ -101,7 +101,7 @@ class DayScene(BaseScene): else: self._tool = tool.name if self._tool == 'seed': - self._set_cursor(tool.name) + self._set_cursor('seed', transform=Alpha(alpha=172)) elif self._tool == 'red_spotlight': self._set_cursor( 'spotlight', diff --git a/tabakrolletjie/transforms.py b/tabakrolletjie/transforms.py index b748b6e..88f5161 100644 --- a/tabakrolletjie/transforms.py +++ b/tabakrolletjie/transforms.py @@ -64,3 +64,13 @@ class Multiply(Transform): mult.fill(self.colour) surface.blit(mult, (0, 0), None, pgl.BLEND_RGBA_MULT) return surface + + +class Alpha(Transform): + """ Make translucent. """ + + ARGS = ["alpha"] + + def apply(self, surface): + surface.fill((255, 255, 255, self.alpha), None, pgl.BLEND_RGBA_MULT) + return surface -- 2.34.1