consistent left alignment in the info area
authoradrianna <adrianna.pinska@gmail.com>
Fri, 16 May 2014 14:16:50 +0000 (16:16 +0200)
committeradrianna <adrianna.pinska@gmail.com>
Fri, 16 May 2014 14:17:01 +0000 (16:17 +0200)
naja/constants.py
naja/widgets/info_area.py

index 1ce931a871bdcfbc9dad55d38595607c24070746..4d7559acbe3cb2d1aaf2025b403176b8b24a3dec 100644 (file)
@@ -66,6 +66,7 @@ SMALL_LOCK_HEIGHT = 24
 BOARD_SIZE = (5 * TILE_SIZE[0], 5 * TILE_SIZE[1])
 BIT_SIZE = (5 * TILE_SIZE[0], (SCREEN[1] - 5 * TILE_SIZE[1]) // 2)
 INFO_SIZE = (SCREEN[0] - 5 * TILE_SIZE[0], SCREEN[1])
+INFO_LEFT_PADDING = 18
 PLAYER_SIZE = (64, 96)
 
 # Player States
index 2f75a635b3bb9096f329204020476174aabd123f..6f14ef7fa18e900cce30ac02186f1b262092077f 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, PALETTE)
+                            EXAMINE, PALETTE, INFO_LEFT_PADDING)
 from naja.events import finish_event
 from naja.resources import resources
 from naja.resources.mutators import EIGHT_BIT
@@ -48,7 +48,7 @@ class InfoAreaWidget(Widget):
         self.surface = pygame.surface.Surface(INFO_SIZE)
         self.surface.fill((0, 0, 0))
         # Extract actions and such from the card
-        title = TextWidget((0, 0), TITLES[self.state.gameboard.player_mode],
+        title = TextWidget((INFO_LEFT_PADDING, 0), TITLES[self.state.gameboard.player_mode],
                            colour=PALETTE.WHITE)
         title.render(self.surface)
         y_offset = title.surface.get_rect().height + 8
@@ -59,7 +59,7 @@ class InfoAreaWidget(Widget):
         if self.card.bitwise_operand:
             bits_text = '%s %s' % (
                 bits_text, bit_glyphs(self.card.bitwise_operand))
-        card_bits = TextBoxWidget((0, y_offset), bits_text,
+        card_bits = TextBoxWidget((INFO_LEFT_PADDING, y_offset), bits_text,
                                   box_width=INFO_SIZE[0],
                                   colour=PALETTE.LIGHT_TURQUOISE,
                                   bg_colour=PALETTE.BLACK)
@@ -77,11 +77,11 @@ class InfoAreaWidget(Widget):
         hint = TextBoxWidget((4, 0), hint_text, 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, (4, y_offset))
+        y_offset = INFO_SIZE[1] - hint.surface.get_rect().height - INFO_LEFT_PADDING -2
+        self.surface.blit(hint.surface, (INFO_LEFT_PADDING, y_offset))
 
     def prepare_action(self, choice, action, y_offset):
-        x_offset = 18
+        x_offset = INFO_LEFT_PADDING
         action_viable = action.check_available(self.state.player)
         text_colour = PALETTE.BLACK if action_viable else PALETTE.GREY