diff options
| author | manuel <manuel@mausz.at> | 2011-04-06 15:07:50 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-04-06 15:07:50 +0200 |
| commit | 2b3210e6d19e32b7746e0e1cdf22035ce508ca8a (patch) | |
| tree | 2fdd4967de000e72c9a9f83eefad47e7f13e6e21 /pacman-c++/block.cpp | |
| parent | 6dc8b50817fe5da8550c245db755f7014402c62a (diff) | |
| download | foop-2b3210e6d19e32b7746e0e1cdf22035ce508ca8a.tar.gz foop-2b3210e6d19e32b7746e0e1cdf22035ce508ca8a.tar.bz2 foop-2b3210e6d19e32b7746e0e1cdf22035ce508ca8a.zip | |
adding nicer blocks :D
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 | } | ||
