diff options
Diffstat (limited to 'pacman-c++/block.cpp')
| -rw-r--r-- | pacman-c++/block.cpp | 8 |
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 | ||
| 5 | QMap<Color::Color, QPixmap> Block::m_pixmaps; | 5 | QMap<Color::Color, QPixmap> Block::m_pixmaps; |
| 6 | 6 | ||
| 7 | Block::Block(Color::Color color, Neighbour neighbour, QGraphicsItem *parent) | 7 | Block::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 | |||
| 20 | void Block::setNeighbours(unsigned int neighbours) | ||
| 21 | { | ||
| 22 | setSprite(neighbours * SPRITE_OFFSET, 0, SPRITE_WIDTH, SPRITE_HEIGHT); | ||
| 23 | } | ||
