X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=tabakrolletjie%2Fscenes%2Fday.py;h=9e55fba1ce3c9763cf93fbdc53ec04a9e496475c;hb=34bf27ff5767c844cecd4f80d89a8d5d928efdfd;hp=5674ab2cbbb281feace6966d7ae6c36bb7437b75;hpb=d16507c49b10bdcfc70aa6f813182ec26a4be2da;p=tabakrolletjie.git diff --git a/tabakrolletjie/scenes/day.py b/tabakrolletjie/scenes/day.py index 5674ab2..9e55fba 100644 --- a/tabakrolletjie/scenes/day.py +++ b/tabakrolletjie/scenes/day.py @@ -1,7 +1,6 @@ """ Be prepared. """ import pygame.locals as pgl -import pygame.surface import pymunk import pymunk.pygame_util @@ -12,6 +11,7 @@ from ..obstacles import ObstacleManager from ..events import SceneChangeEvent from ..utils import debug_timer from ..loader import loader +from ..transforms import Overlay from ..constants import SCREEN_SIZE, FONTS from ..widgets import ImageButton @@ -19,6 +19,9 @@ from ..turnip import Turnip, TurnipInvalidPosition class DayScene(BaseScene): + + BRIGHTNESS = Overlay(colour=(255, 255, 255, 50)) + def enter(self, gamestate): self._space = pymunk.Space() self._toolbar_font = loader.load_font(FONTS['sans'], size=20) @@ -46,6 +49,9 @@ class DayScene(BaseScene): pos=(SCREEN_SIZE[0] - 50, SCREEN_SIZE[1] - 40)), ] self._update_toolbar(gamestate) + # Background + self._soil = loader.load_image( + "textures", "soil.png", transform=self.BRIGHTNESS) def exit(self, gamestate): self._unset_cursor() @@ -56,11 +62,7 @@ class DayScene(BaseScene): @debug_timer("day.render") def render(self, surface, gamestate): - surface.blit(loader.load_image("textures", "soil.png"), (0, 0)) - brightness = pygame.surface.Surface(surface.get_size()) - brightness = brightness.convert_alpha() - brightness.fill((255, 255, 255, 50)) - surface.blit(brightness, (0, 0)) + surface.blit(self._soil, (0, 0)) for turnip in self._turnips: turnip.render(surface)