From 01008fbdb6fd368d2c6df854725d608d6a3fb0cc Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 11 May 2014 18:34:36 +0200 Subject: [PATCH] Add placeholder drawing logic --- naja/constants.py | 2 ++ naja/widgets/tile.py | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/naja/constants.py b/naja/constants.py index 25a8cfc..d8087d6 100644 --- a/naja/constants.py +++ b/naja/constants.py @@ -35,3 +35,5 @@ BITS = AttrDict({ }) DIRECTION_BITS = AttrDict((k, v) for k, v in BITS.items() if v < 4) CONDITION_BITS = AttrDict((k, v) for k, v in BITS.items() if v >= 4) + +TILE_SIZE = (96, 96) diff --git a/naja/widgets/tile.py b/naja/widgets/tile.py index 6750584..db20cda 100644 --- a/naja/widgets/tile.py +++ b/naja/widgets/tile.py @@ -1,15 +1,25 @@ -#from naja.constants import TILE_SIZE +from naja.constants import TILE_SIZE from naja.widgets.base import Widget from naja.resources import resources +# These will probably need to go away when we have images +import pygame +import pygame.locals as pgl + class TileWidget(Widget): """Widget which holds a tile on the game board.""" def __init__(self, pos, image=None): - super(TileWidget, self).__init__(pos, (96, 96)) + super(TileWidget, self).__init__(pos, TILE_SIZE) + self.image = image def prepare(self): - pass + # Placeholder logic - just draw the outline of a square + self.surface = pygame.surface.Surface(self.size) + pygame.draw.lines(self.surface, pgl.color.THECOLORS['yellow'], + True, [(1, 1), (1, 95), (95, 95), (95, 1)], 2) + self.surface.convert_alpha(pygame.display.get_surface()) + self.size = self.surface.get_rect().size def draw(self, surface): surface.blit(self.surface, self.rect) -- 2.34.1