From cb921f781f13dd63f1f1c788f5fa6075487b53d9 Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Fri, 9 Sep 2016 21:57:29 +0200 Subject: [PATCH] 55 FPS, remove a blit. --- tabakrolletjie/lights.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tabakrolletjie/lights.py b/tabakrolletjie/lights.py index 108f795..59bbe17 100644 --- a/tabakrolletjie/lights.py +++ b/tabakrolletjie/lights.py @@ -178,10 +178,14 @@ class BaseLight(object): pygame.draw.polygon(ray_mask, white, pygame_poly, 1) dt.lap("ray mask rendered") + light_colour = self.COLOURS[self.colour] + intensity = int(255 * self.intensity) + light_colour = light_colour + (intensity,) + radius_mask.fill(black) centre = pymunk.pygame_util.to_pygame(self.position, surface) pygame.draw.circle( - radius_mask, white, centre, int(max_radius), 0) + radius_mask, light_colour, centre, int(max_radius), 0) pygame.draw.circle( radius_mask, black, centre, int(min_radius), 0) dt.lap("radius mask rendered") @@ -189,13 +193,6 @@ class BaseLight(object): ray_mask.blit(radius_mask, dest_rect, dest_rect, pgl.BLEND_RGBA_MULT) dt.lap("blitted radius mask to ray mask") - light_colour = self.COLOURS[self.colour] - intensity = int(255 * self.intensity) - light_colour = light_colour + (intensity,) - - ray_mask.fill(light_colour, dest_rect, pgl.BLEND_RGBA_MULT) - dt.lap("coloured ray mask") - surface.blit(ray_mask, dest_rect, dest_rect) dt.lap("blitted surface") dt.end() -- 2.34.1