Mercurial > boomslang
changeset 668:387b4288d357 pyntnclick
Centre labels
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sun, 12 Feb 2012 17:37:21 +0200 |
parents | c71530b8a19d |
children | 562f8133bb07 |
files | pyntnclick/state.py |
diffstat | 1 files changed, 4 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/pyntnclick/state.py Sun Feb 12 17:28:20 2012 +0200 +++ b/pyntnclick/state.py Sun Feb 12 17:37:21 2012 +0200 @@ -3,7 +3,6 @@ import copy from widgets.text import LabelWidget -from pygame.rect import Rect from pygame.color import Color @@ -336,27 +335,19 @@ self.game.current_thing.leave() self.game.current_thing = None - def _get_description(self): + def _get_description(self, dest_rect): text = (self.game.current_thing and self.game.current_thing.get_description()) if text is None: return None - label = LabelWidget((10, 10), self.gd, text) - #label.set_margin(5) - #label.border_width = 1 - #label.border_color = (0, 0, 0) - #label.bg_color = Color(210, 210, 210, 255) - #label.fg_color = (0, 0, 0) + label = LabelWidget((0, 10), self.gd, text) + label.rect.left += (dest_rect.width - label.rect.width) / 2 return label def draw_description(self, surface): - description = self._get_description() + description = self._get_description(surface.get_rect()) if description is not None: description.draw(surface) - #x, y, w, h = description.rect - #sub = screen.get_root().surface.subsurface( - # Rect(400 - w / 2, 5, w, h)) - #description.draw_all(sub) def _cache_background(self): if self.BACKGROUND and not self._background: