Tweak hint position and add padding
[naja.git] / naja / widgets / info_area.py
index a2406746dea23cc1f85b0958ce4cc015e0f320d0..a89e96533dfee3b7773aeb21c7876bb6e4963c6c 100644 (file)
@@ -61,11 +61,12 @@ class InfoAreaWidget(Widget):
         for choice, action in enumerate(self.card.actions):
             y_offset = self.prepare_action(choice, action, y_offset)
         # We cheat horribly for layout reasons
-        hint = TextBoxWidget((0, 0), HINTS[self.state.gameboard.player_mode],
-                             box_width=INFO_SIZE[0] // EIGHT_BIT_SCALE)
+        hint = TextBoxWidget((4, 0), HINTS[self.state.gameboard.player_mode],
+                             padding=2,
+                             box_width=(INFO_SIZE[0] - 4) // EIGHT_BIT_SCALE)
         hint.prepare()
         y_offset = INFO_SIZE[1] - hint.surface.get_rect().height
-        self.surface.blit(hint.surface, (0, y_offset))
+        self.surface.blit(hint.surface, (4, y_offset))
 
     def prepare_action(self, choice, action, y_offset):
         if action.required_bits:
@@ -76,14 +77,17 @@ class InfoAreaWidget(Widget):
             self.surface.blit(img, (0, y_offset))
             y_offset += 8
         text = TextBoxWidget(
-            (12, y_offset), action.TEXT,
+            (12, y_offset), action.get_text(),
             box_width=(INFO_SIZE[0] - 12) // 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:
-            colour = (255, 255, 0, 128)
+            if not action.check_available(self.state.player):
+                colour = (255, 0, 0, 255)
+            else:
+                colour = (255, 255, 0, 128)
             bottom = y_offset + text.surface.get_rect().height
             right = text.surface.get_rect().width + 12
             pygame.draw.lines(self.surface, colour, True,