X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fwidgets%2Ftile.py;h=7550ba573ba147c4e39d3e0bccb7325bd318251e;hb=7ffa20720668ad9e8701d0b5f98a2e3161132423;hp=6750584f071f1587052f09396964bdd5c8eae2fd;hpb=be75518bbe5076736a7a1c75d981449b5ca8d016;p=naja.git diff --git a/naja/widgets/tile.py b/naja/widgets/tile.py index 6750584..7550ba5 100644 --- a/naja/widgets/tile.py +++ b/naja/widgets/tile.py @@ -1,15 +1,25 @@ -#from naja.constants import TILE_SIZE -from naja.widgets.base import Widget +# These will probably need to go away when we have images +import pygame +import pygame.locals as pgl + +from naja.constants import TILE_SIZE from naja.resources import resources +from naja.widgets.base import Widget 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(TILE_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)