From ac0e0fedcf5c82758fda2396a84dc132b0c1d107 Mon Sep 17 00:00:00 2001 From: adrianna Date: Fri, 16 May 2014 16:16:50 +0200 Subject: [PATCH] consistent left alignment in the info area --- naja/constants.py | 1 + naja/widgets/info_area.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/naja/constants.py b/naja/constants.py index 1ce931a..4d7559a 100644 --- a/naja/constants.py +++ b/naja/constants.py @@ -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 diff --git a/naja/widgets/info_area.py b/naja/widgets/info_area.py index 2f75a63..6f14ef7 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, 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 -- 2.34.1