diff options
| author | manuel <manuel@mausz.at> | 2011-04-12 14:45:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-04-12 14:45:24 +0200 |
| commit | dbeba838ea813b620ec571265c8ea417403fc81c (patch) | |
| tree | cf085b766ba8dad8146190dc7f438160b839feb4 /pacman-c++/actor.cpp | |
| parent | b695f67ef718724144a3a5c4be42be373b0f691f (diff) | |
| download | foop-dbeba838ea813b620ec571265c8ea417403fc81c.tar.gz foop-dbeba838ea813b620ec571265c8ea417403fc81c.tar.bz2 foop-dbeba838ea813b620ec571265c8ea417403fc81c.zip | |
make the server a non gui application
this required a lot of reorganization:
- don't create ANY pixmaps. that requires QtGui
- don't create and QtWidgets
- thus SceneHolder is now a QGraphisScene itself
- and MainWidgets is a QWidget having SceneHolder as member variable
Diffstat (limited to 'pacman-c++/actor.cpp')
| -rw-r--r-- | pacman-c++/actor.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index bb062ea..baf6dca 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp | |||
| @@ -13,7 +13,6 @@ Actor::Actor(Color::Color color, bool local, QGraphicsItem *parent) | |||
| 13 | : PixmapItem(parent), m_color(color), m_direction(Actor::None), m_local(local), | 13 | : PixmapItem(parent), m_color(color), m_direction(Actor::None), m_local(local), |
| 14 | m_player(NULL), m_roundPoints(0), m_gamePoints(0) | 14 | m_player(NULL), m_roundPoints(0), m_gamePoints(0) |
| 15 | { | 15 | { |
| 16 | m_pix = ":/" + QString("actor%1").arg((m_color >> 1) + 1); | ||
| 17 | /* DON'T set any pixmap here. we've a pixmap in the animation | 16 | /* DON'T set any pixmap here. we've a pixmap in the animation |
| 18 | * but we need a sprite for the collision detection | 17 | * but we need a sprite for the collision detection |
| 19 | */ | 18 | */ |
| @@ -21,6 +20,13 @@ Actor::Actor(Color::Color color, bool local, QGraphicsItem *parent) | |||
| 21 | /* higher player "over" lower player */ | 20 | /* higher player "over" lower player */ |
| 22 | setZValue(m_color * 10); | 21 | setZValue(m_color * 10); |
| 23 | 22 | ||
| 23 | /* rest of the ctor is only for clients */ | ||
| 24 | if (Constants::server) | ||
| 25 | return; | ||
| 26 | |||
| 27 | /* our actor pixmap. created after server part */ | ||
| 28 | m_pix = ":/" + QString("actor%1").arg((m_color >> 1) + 1); | ||
| 29 | |||
| 24 | /* setup icon for player */ | 30 | /* setup icon for player */ |
| 25 | m_icon.setPixmap(m_pix); | 31 | m_icon.setPixmap(m_pix); |
| 26 | m_icon.setSprite(Constants::sprite_margin, Constants::sprite_margin, Constants::field_size.width, Constants::field_size.height); | 32 | m_icon.setSprite(Constants::sprite_margin, Constants::sprite_margin, Constants::field_size.width, Constants::field_size.height); |
