Always draw borders.
authorSimon Cross <hodgestar@gmail.com>
Thu, 15 May 2014 19:28:27 +0000 (21:28 +0200)
committerSimon Cross <hodgestar@gmail.com>
Thu, 15 May 2014 19:28:43 +0000 (21:28 +0200)
naja/widgets/info_area.py

index 1f656feba3c08e8c54efc873fe5e71d41022b2d9..5f19a1ed77435c84c58a897992b72b768db87dc1 100644 (file)
@@ -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: