projects
/
naja.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b6e9d53
)
Add placeholder drawing logic
author
Neil
<neil@dip.sun.ac.za>
Sun, 11 May 2014 16:34:36 +0000
(18:34 +0200)
committer
Neil
<neil@dip.sun.ac.za>
Sun, 11 May 2014 17:03:14 +0000
(19:03 +0200)
naja/constants.py
patch
|
blob
|
history
naja/widgets/tile.py
patch
|
blob
|
history
diff --git
a/naja/constants.py
b/naja/constants.py
index 25a8cfcb45c9348773f3c35fac1bc67514d2ed01..d8087d617fb2168a1e3385d4e41e3546d55b26ac 100644
(file)
--- 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)
})
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 6750584f071f1587052f09396964bdd5c8eae2fd..db20cda7a597c9eec410967381e586cf85ef315a 100644
(file)
--- 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
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):
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):
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)
def draw(self, surface):
surface.blit(self.surface, self.rect)