summaryrefslogtreecommitdiffstats
path: root/pacman-c++/bonuspoint.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-04-05 12:26:04 +0200
committermanuel <manuel@mausz.at>2011-04-05 12:26:04 +0200
commitbfaf2e63e64169abbb1a4c079a937091060574b7 (patch)
tree4054c7cce1f9e8aaa467ef51e28c581c40986b93 /pacman-c++/bonuspoint.cpp
parent897bc2bb42d79369d2f915d0da4e3b7f3b1a6fce (diff)
downloadfoop-bfaf2e63e64169abbb1a4c079a937091060574b7.tar.gz
foop-bfaf2e63e64169abbb1a4c079a937091060574b7.tar.bz2
foop-bfaf2e63e64169abbb1a4c079a937091060574b7.zip
forgot some commits..
replace std::map with QMap
Diffstat (limited to 'pacman-c++/bonuspoint.cpp')
-rw-r--r--pacman-c++/bonuspoint.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/pacman-c++/bonuspoint.cpp b/pacman-c++/bonuspoint.cpp
index e2fdba0..8ebc195 100644
--- a/pacman-c++/bonuspoint.cpp
+++ b/pacman-c++/bonuspoint.cpp
@@ -1,14 +1,21 @@
1#include "bonuspoint.h" 1#include "bonuspoint.h"
2#include "constants.h"
3#include <QDebug>
4
5#define BONUSPOINTS_NUM_SPRITES 4
2 6
3namespace 7namespace
4{ 8{
5 QPixmap *pixmap = 0; 9 QPixmap *pixmap = NULL;
6} 10}
7 11
8BonusPoint::BonusPoint(QGraphicsItem *parent) 12BonusPoint::BonusPoint(QGraphicsItem *parent)
9 : PixmapItem(parent) 13 : PixmapItem(parent)
10{ 14{
11 if (pixmap == 0) 15 if (pixmap == NULL)
12 pixmap = new QPixmap(":/cherry"); 16 pixmap = new QPixmap(":/bonuspoints");
13 setPixmap(*pixmap); 17 setPixmap(*pixmap);
18
19 int rand = (int) (BONUSPOINTS_NUM_SPRITES * (qrand() / (RAND_MAX + 1.0)));
20 setSprite(rand * 20 + SPRITE_MARGIN, SPRITE_MARGIN, SPRITE_WIDTH, SPRITE_HEIGHT);
14} 21}