diff options
| author | totycro <totycro@unknown-horizons.org> | 2011-04-04 19:20:32 +0200 |
|---|---|---|
| committer | totycro <totycro@unknown-horizons.org> | 2011-04-04 19:20:32 +0200 |
| commit | 0693d00da48d795c7ccb658e8b69fe17f4427337 (patch) | |
| tree | c750928f839ebf242fe9fdfefec904c921889931 /pacman-c++/block.cpp | |
| parent | f3f2cc63376019aaf9e8dd807ab674f92908123c (diff) | |
| download | foop-0693d00da48d795c7ccb658e8b69fe17f4427337.tar.gz foop-0693d00da48d795c7ccb658e8b69fe17f4427337.tar.bz2 foop-0693d00da48d795c7ccb658e8b69fe17f4427337.zip | |
Cache QPixmaps for Blocks
Diffstat (limited to 'pacman-c++/block.cpp')
| -rw-r--r-- | pacman-c++/block.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pacman-c++/block.cpp b/pacman-c++/block.cpp index 11c2a32..d5435f3 100644 --- a/pacman-c++/block.cpp +++ b/pacman-c++/block.cpp | |||
| @@ -4,5 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | Block::Block(Actor::Type type) | 5 | Block::Block(Actor::Type type) |
| 6 | { | 6 | { |
| 7 | setPixmap(QPixmap(":/" + QString("block%1").arg(type))); | 7 | if (m_pixmaps.find(type) == m_pixmaps.end()) { |
| 8 | QString pixmapName = ":/" + QString("block%1").arg(type); | ||
| 9 | m_pixmaps[type] = QPixmap( pixmapName ); | ||
| 10 | } | ||
| 11 | setPixmap( m_pixmaps.find(type)->second ); | ||
| 8 | } | 12 | } |
