Changeset 338:af021507a7e3


Ignore:
Timestamp:
04/09/11 10:47:09 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Message:

Translucent dialogs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/widgets/bubble.py

    r309 r338  
    11"""Widget for in-level dialogue / speech bubbles."""
    22
    3 from pygame.locals import (KEYDOWN, K_UP, K_p, K_q, K_x, K_z, K_RETURN, BLEND_ADD)
     3from pygame.locals import (KEYDOWN, K_UP, K_p, K_q, K_x, K_z, K_RETURN, SRCALPHA)
    44import pygame.draw
    55import pygame
     
    5757            bgrect = self._text.rect.union(self._text_choice.rect)
    5858            bgrect.inflate_ip(10, 10)
    59             level_surface.fill((255, 255, 255), bgrect)
    60             pygame.draw.rect(level_surface, (0, 0, 0), bgrect, 1)
     59            bgrect2 = bgrect.move(0, 0) #
     60            bgrect2.topleft = (0, 0)
     61            bgsurf = pygame.Surface(bgrect.size, flags=SRCALPHA)
     62            bgsurf.fill((255, 255, 255, 120))
     63            pygame.draw.rect(bgsurf, (0, 0, 0, 120), bgrect2, 1)
     64            level_surface.blit(bgsurf, bgrect)
     65
    6166
    6267            self._text.draw(level_surface)
Note: See TracChangeset for help on using the changeset viewer.