Add placeholder drawing logic
[naja.git] / naja / widgets / tile.py
index 6750584f071f1587052f09396964bdd5c8eae2fd..db20cda7a597c9eec410967381e586cf85ef315a 100644 (file)
@@ -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)