Changeset 259:030387133ace


Ignore:
Timestamp:
04/07/11 23:51:42 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Message:

Add background to make dialogue more readable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/widgets/bubble.py

    r258 r259  
    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)
     3from pygame.locals import (KEYDOWN, K_UP, K_p, K_q, K_x, K_z, K_RETURN, BLEND_ADD)
     4import pygame.draw
    45import pygame
    56
     
    4142        if self._text:
    4243            self._text.rect.center = level_surface.get_clip().center
    43             self._text.draw(level_surface)
    4444            self._text_choice.rect.topleft = self._text.rect.bottomleft
    4545            self._text_choice.rect.move_ip((0, 10))
     46
     47            bgrect = self._text.rect.union(self._text_choice.rect)
     48            bgrect.inflate_ip(10, 10)
     49            level_surface.fill((255, 255, 255), bgrect)
     50            pygame.draw.rect(level_surface, (0, 0, 0), bgrect, 1)
     51
     52            self._text.draw(level_surface)
    4653            self._text_choice.draw(level_surface)
    4754
Note: See TracChangeset for help on using the changeset viewer.