diff options
| author | totycro <totycro@unknown-horizons.org> | 2011-04-09 13:54:18 +0200 |
|---|---|---|
| committer | totycro <totycro@unknown-horizons.org> | 2011-04-09 13:54:18 +0200 |
| commit | d547dec802f76c346538144f4eacf6d8ca6310c4 (patch) | |
| tree | 50613653be09988bfd1a122496faed93c960de45 /pacman-c++/mainwidget.h | |
| parent | 7e4bc8ece49543533c4e27f5d6bc867c1bada601 (diff) | |
| download | foop-d547dec802f76c346538144f4eacf6d8ca6310c4.tar.gz foop-d547dec802f76c346538144f4eacf6d8ca6310c4.tar.bz2 foop-d547dec802f76c346538144f4eacf6d8ca6310c4.zip | |
Pull up methods from mainwidget to sceneholder for sharing in both client and server
Diffstat (limited to 'pacman-c++/mainwidget.h')
| -rw-r--r-- | pacman-c++/mainwidget.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/pacman-c++/mainwidget.h b/pacman-c++/mainwidget.h index e7d146f..27e901f 100644 --- a/pacman-c++/mainwidget.h +++ b/pacman-c++/mainwidget.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef MAINWIDGET_H | 1 | #ifndef MAINWIDGET_H |
| 2 | #define MAINWIDGET_H | 2 | #define MAINWIDGET_H |
| 3 | 3 | ||
| 4 | #include "sceneholder.h" | ||
| 5 | |||
| 4 | #include "constants.h" | 6 | #include "constants.h" |
| 5 | #include "pixmapitem.h" | 7 | #include "pixmapitem.h" |
| 6 | #include <QtGui> | 8 | #include <QtGui> |
| @@ -10,21 +12,22 @@ | |||
| 10 | class Actor; | 12 | class Actor; |
| 11 | 13 | ||
| 12 | class MainWidget | 14 | class MainWidget |
| 13 | : public QWidget | 15 | : public SceneHolder |
| 14 | { | 16 | { |
| 15 | Q_OBJECT | 17 | Q_OBJECT |
| 16 | 18 | ||
| 17 | public: | 19 | public: |
| 18 | MainWidget(); | 20 | MainWidget(QWidget *parent = 0); |
| 19 | 21 | ||
| 20 | protected: | 22 | protected: |
| 21 | // handling of current key | 23 | // handling of current key |
| 22 | virtual void keyPressEvent(QKeyEvent* ); | 24 | virtual void keyPressEvent(QKeyEvent* ); |
| 23 | virtual void keyReleaseEvent(QKeyEvent* ); | 25 | virtual void keyReleaseEvent(QKeyEvent* ); |
| 24 | 26 | ||
| 27 | virtual void updateMap(const Transmission::map_t& map); | ||
| 28 | |||
| 25 | private: | 29 | private: |
| 26 | void createGui(); | 30 | void createGui(); |
| 27 | void updateMap(const Transmission::map_t& map); | ||
| 28 | void updateScore(); | 31 | void updateScore(); |
| 29 | bool isRunning(); | 32 | bool isRunning(); |
| 30 | 33 | ||
| @@ -34,17 +37,9 @@ private slots: | |||
| 34 | void tick(); | 37 | void tick(); |
| 35 | 38 | ||
| 36 | private: | 39 | private: |
| 37 | QVector< QVector<PixmapItem *> > visualMap; | ||
| 38 | |||
| 39 | // data conversion | ||
| 40 | QPoint mapPositionToCoord(unsigned int x, unsigned int y); | ||
| 41 | 40 | ||
| 42 | // GUI elements needed in the progress of the game | 41 | // GUI elements needed in the progress of the game |
| 43 | QList<QGridLayout*> m_playerScoreLayouts; | 42 | QList<QGridLayout*> m_playerScoreLayouts; |
| 44 | QGraphicsScene *m_scene; | ||
| 45 | |||
| 46 | // map of actors in order to keep track of those instances | ||
| 47 | QMap<Color::Color, Actor*> m_actors; | ||
| 48 | 43 | ||
| 49 | // key currently pressed by user | 44 | // key currently pressed by user |
| 50 | Transmission::field_t m_currentKey; | 45 | Transmission::field_t m_currentKey; |
