# HG changeset patch # User Simon Cross # Date 1282596150 -7200 # Node ID bb7c8072f8c06f13adbf60e02e724e0dd8fdee80 # Parent 1a5fdc22593912f691994bc4af5ade7c2a13a64d Some hacks to make Label work. diff -r 1a5fdc225939 -r bb7c8072f8c0 gamelib/state.py --- a/gamelib/state.py Mon Aug 23 22:11:41 2010 +0200 +++ b/gamelib/state.py Mon Aug 23 22:42:30 2010 +0200 @@ -132,7 +132,12 @@ if text is None: return None label = Label(text) - label.margin = 5 + # TODO: create derived label class that does this + # manually recalculate size + d = 5 + w, h = label.size + label.margin = d + label.size = (w+2*d, h+2*d) label.border_width = 1 label.border_color = (0, 0, 0) label.bg_color = (127, 127, 127) @@ -141,7 +146,9 @@ def draw_description(self, surface): if self._current_description is not None: - self._current_description.draw(surface) + sub = surface.subsurface( + Rect(5, 5, *self._current_description.size)) + self._current_description.draw_all(sub) def draw_background(self, surface): surface.blit(self._background, (0, 0), None, BLEND_ADD)