From: Neil Date: Sun, 11 May 2014 16:34:36 +0000 (+0200) Subject: Add placeholder drawing logic X-Git-Tag: 0.1~408 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=01008fbdb6fd368d2c6df854725d608d6a3fb0cc;p=naja.git Add placeholder drawing logic --- 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)