summaryrefslogtreecommitdiffstats
path: root/pacman-c++/block.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pacman-c++/block.cpp')
-rw-r--r--pacman-c++/block.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/pacman-c++/block.cpp b/pacman-c++/block.cpp
index ccb7ade..9e5e427 100644
--- a/pacman-c++/block.cpp
+++ b/pacman-c++/block.cpp
@@ -4,7 +4,7 @@
4 4
5QMap<Color::Color, QPixmap> Block::m_pixmaps; 5QMap<Color::Color, QPixmap> Block::m_pixmaps;
6 6
7Block::Block(Color::Color color, Neighbour neighbour, QGraphicsItem *parent) 7Block::Block(Color::Color color, unsigned int neighbours, QGraphicsItem *parent)
8 : PixmapItem(parent) 8 : PixmapItem(parent)
9{ 9{
10 if (m_pixmaps.find(color) == m_pixmaps.end()) 10 if (m_pixmaps.find(color) == m_pixmaps.end())
@@ -13,5 +13,11 @@ Block::Block(Color::Color color, Neighbour neighbour, QGraphicsItem *parent)
13 m_pixmaps[color] = QPixmap(pixmapName); 13 m_pixmaps[color] = QPixmap(pixmapName);
14 } 14 }
15 setPixmap(m_pixmaps.find(color).value()); 15 setPixmap(m_pixmaps.find(color).value());
16 setNeighbours(neighbours);
16 qDebug() << "loading block w color: " << color; 17 qDebug() << "loading block w color: " << color;
17} 18}
19
20void Block::setNeighbours(unsigned int neighbours)
21{
22 setSprite(neighbours * SPRITE_OFFSET, 0, SPRITE_WIDTH, SPRITE_HEIGHT);
23}