Changeset 396:b3df20c76afd


Ignore:
Timestamp:
Sep 6, 2013, 11:05:18 PM (7 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
rebase_source:
99415f45a12fff748660f2a0a1a300d19628495d
Message:

Pass layout hint to overlays

Location:
nagslang
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nagslang/render.py

    r388 r396  
    167167        self.game_object = game_object
    168168
    169     def render(self, surface, display_offset):
     169    def render(self, surface, display_offset, max_width):
    170170        pass
    171171
     
    179179        self.widget = LabelWidget((20, 20), self.text)
    180180
    181     def render(self, surface, display_offset):
     181    def render(self, surface, display_offset, max_width):
    182182        x, y = 20, 20
    183183        if display_offset[0] < 0:
  • nagslang/screens/area.py

    r394 r396  
    215215        render_rect = self._calc_viewport(mysurface, surface)
    216216        surface.blit(mysurface, (0, 0), render_rect)
     217        # Maximum width we allow for overlays
     218        max_width = min(render_rect.width, mysurface.get_width())
    217219        for overlay in self._level.overlay_drawables:
    218220            if overlay.is_visible():
    219                 overlay.render(surface, render_rect.topleft)
     221                overlay.render(surface, render_rect.topleft, max_width)
    220222        self.render_health_bar(surface)
    221223
Note: See TracChangeset for help on using the changeset viewer.