From: Simon Cross Date: Thu, 15 May 2014 19:28:27 +0000 (+0200) Subject: Always draw borders. X-Git-Tag: 0.1~266 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=d547c9cfce2e4bdeb1beacf7c124d40a29ca65e8;p=naja.git Always draw borders. --- diff --git a/naja/widgets/info_area.py b/naja/widgets/info_area.py index 1f656fe..5f19a1e 100644 --- a/naja/widgets/info_area.py +++ b/naja/widgets/info_area.py @@ -5,7 +5,7 @@ import pygame import pygame.locals as pgl from naja.constants import (INFO_SIZE, EIGHT_BIT_SCALE, ACT, KEYS, - EXAMINE) + EXAMINE, PALETTE) from naja.events import finish_event from naja.resources import resources from naja.resources.mutators import EIGHT_BIT @@ -79,15 +79,17 @@ class InfoAreaWidget(Widget): box_width=(INFO_SIZE[0] - 16) // EIGHT_BIT_SCALE, fontsize=28) text.render(self.surface) - # self.chosen may be None, in which case we don't draw the border. - if choice == self.chosen: - if not action.check_available(self.state.player): - colour = (255, 0, 0, 255) - else: - colour = (255, 255, 0, 128) + border_colour = None + if not action.check_available(self.state.player): + border_colour = PALETTE.ORANGE + (255,) + elif choice == self.chosen: + border_colour = PALETTE.PINK + (128,) + else: + border_colour = PALETTE.GREEN + (128,) + if border_colour: bottom = y_offset + text.surface.get_rect().height - right = text.surface.get_rect().width + 12 - pygame.draw.lines(self.surface, colour, True, + right = text.surface.get_rect().width + 18 + pygame.draw.lines(self.surface, border_colour, True, [(18, y_offset), (right, y_offset), (right, bottom), (18, bottom)], 4) if action.required_bits: