X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fwidgets%2Fboard.py;h=1f59f015f1cb1eacd5bb68de952986942c160b3c;hb=b3db4400695249420f5f941744c2a2692a1bad98;hp=c791a57610231ccd477e14e30ebf6b4d993f2ba9;hpb=0f233e6d450d863f06f5acddee3bd94f53594d08;p=naja.git diff --git a/naja/widgets/board.py b/naja/widgets/board.py index c791a57..1f59f01 100644 --- a/naja/widgets/board.py +++ b/naja/widgets/board.py @@ -2,18 +2,31 @@ Widget that holds the game tiles. """ +from naja.constants import BOARD_SIZE, TILE_SIZE + from .base import Widget +from .tile import TileWidget class BoardWidget(Widget): """ Widget which holds all the tiles that make up the gameboard. """ - def __init__(self, pos, image=None): - super(BoardWidget, self).__init__(pos, (96, 96)) + def __init__(self, pos, tiles=None): + super(BoardWidget, self).__init__(pos, BOARD_SIZE) + # FIXME: Placeholder logic + self._tiles = [] + for y in range(0, 5): + for x in range(0, 5): + tile_pos = (pos[0] + x * TILE_SIZE[0], + pos[1] + y * TILE_SIZE[1]) + self._tiles.append(TileWidget(tile_pos, None)) def prepare(self): - pass + for tile in self._tiles: + tile.prepare() + self.size = BOARD_SIZE def draw(self, surface): - surface.blit(self.surface, self.rect) + for tile in self._tiles: + tile.draw(surface)