diff options
Diffstat (limited to 'pacman-c++/mainwidget.cpp')
| -rw-r--r-- | pacman-c++/mainwidget.cpp | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp index 34ff63e..79648c5 100644 --- a/pacman-c++/mainwidget.cpp +++ b/pacman-c++/mainwidget.cpp | |||
| @@ -12,7 +12,7 @@ MainWidget::MainWidget(QWidget *parent) | |||
| 12 | : SceneHolder(parent), m_currentKey(0), m_running(false) | 12 | : SceneHolder(parent), m_currentKey(0), m_running(false) |
| 13 | { | 13 | { |
| 14 | createGui(); | 14 | createGui(); |
| 15 | updateMap(createDummyMap()); | 15 | updateMap(Util::createDummyMap()); |
| 16 | 16 | ||
| 17 | //connect(AudioPlayer::self(), SIGNAL(finished()), this, SLOT(startGame())); | 17 | //connect(AudioPlayer::self(), SIGNAL(finished()), this, SLOT(startGame())); |
| 18 | //AudioPlayer::self()->play(AudioPlayer::Intro); | 18 | //AudioPlayer::self()->play(AudioPlayer::Intro); |
| @@ -123,24 +123,7 @@ Transmission::field_t MainWidget::translateKey(int key) | |||
| 123 | 123 | ||
| 124 | void MainWidget::tick() | 124 | void MainWidget::tick() |
| 125 | { | 125 | { |
| 126 | Actor::Movement mov = Actor::None; | 126 | Actor::Movement mov = Util::transmissionMovementToActor(m_currentKey, Actor::None); |
| 127 | switch(m_currentKey) | ||
| 128 | { | ||
| 129 | case Transmission::direction_up: | ||
| 130 | mov = Actor::Up; | ||
| 131 | break; | ||
| 132 | case Transmission::direction_down: | ||
| 133 | mov = Actor::Down; | ||
| 134 | break; | ||
| 135 | case Transmission::direction_left: | ||
| 136 | mov = Actor::Left; | ||
| 137 | break; | ||
| 138 | case Transmission::direction_right: | ||
| 139 | mov = Actor::Right; | ||
| 140 | break; | ||
| 141 | default: | ||
| 142 | break; | ||
| 143 | } | ||
| 144 | 127 | ||
| 145 | QMapIterator<Color::Color, Actor*> i(m_actors); | 128 | QMapIterator<Color::Color, Actor*> i(m_actors); |
| 146 | while (i.hasNext()) | 129 | while (i.hasNext()) |
| @@ -169,24 +152,7 @@ void MainWidget::keyPressEvent(QKeyEvent* event) | |||
| 169 | return; | 152 | return; |
| 170 | 153 | ||
| 171 | // test stuff | 154 | // test stuff |
| 172 | Actor::Movement mov = Actor::None; | 155 | Actor::Movement mov = Util::transmissionMovementToActor(m_currentKey, Actor::None); |
| 173 | switch(m_currentKey) | ||
| 174 | { | ||
| 175 | case Transmission::direction_up: | ||
| 176 | mov = Actor::Up; | ||
| 177 | break; | ||
| 178 | case Transmission::direction_down: | ||
| 179 | mov = Actor::Down; | ||
| 180 | break; | ||
| 181 | case Transmission::direction_left: | ||
| 182 | mov = Actor::Left; | ||
| 183 | break; | ||
| 184 | case Transmission::direction_right: | ||
| 185 | mov = Actor::Right; | ||
| 186 | break; | ||
| 187 | default: | ||
| 188 | break; | ||
| 189 | } | ||
| 190 | 156 | ||
| 191 | QMapIterator<Color::Color, Actor*> i(m_actors); | 157 | QMapIterator<Color::Color, Actor*> i(m_actors); |
| 192 | while (i.hasNext()) | 158 | while (i.hasNext()) |
