Add tiles to the board. Skip draw for other game scene widgets for now
[naja.git] / naja / widgets / tile.py
1 from naja.constants import TILE_SIZE
2 from naja.resources import resources
3
4 from .base import Widget
5
6 # These will probably need to go away when we have images
7 import pygame
8 import pygame.locals as pgl
9
10
11 class TileWidget(Widget):
12     """Widget which holds a tile on the game board."""
13     def __init__(self, pos, image=None):
14         super(TileWidget, self).__init__(pos, TILE_SIZE)
15         self.image = image
16
17     def prepare(self):
18         # Placeholder logic - just draw the outline of a square
19         self.surface = pygame.surface.Surface(TILE_SIZE)
20         pygame.draw.lines(self.surface, pgl.color.THECOLORS['yellow'],
21                           True, [(1, 1), (1, 95), (95, 95), (95, 1)], 2)
22         self.surface.convert_alpha(pygame.display.get_surface())
23         self.size = self.surface.get_rect().size
24
25     def draw(self, surface):
26         surface.blit(self.surface, self.rect)