summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-11-14 16:55:35 +0300
committerAndrei Karas <akaras@inbox.ru>2012-11-14 18:37:50 +0300
commit13642a6cddd8657ec84a2bfa94c6ac7d34545dba (patch)
treecefec154fe5b6ec59990c4ef5cfe67eba4a484e6 /src/game.cpp
parenteaaafe3312a361e332d495ee68451e424d90a19d (diff)
downloadmanaverse-13642a6cddd8657ec84a2bfa94c6ac7d34545dba.tar.gz
manaverse-13642a6cddd8657ec84a2bfa94c6ac7d34545dba.tar.bz2
manaverse-13642a6cddd8657ec84a2bfa94c6ac7d34545dba.tar.xz
manaverse-13642a6cddd8657ec84a2bfa94c6ac7d34545dba.zip
Add support for on screen joystick for moving.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/game.cpp b/src/game.cpp
index df23a0146..3ed71efcb 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -828,27 +828,30 @@ void Game::handleMove()
}
if (!inputManager.isActionActive(Input::KEY_EMOTE) || direction == 0)
- {
- if (!viewport->getCameraMode())
- {
- player_node->specialMove(direction);
- }
- else
- {
- int dx = 0;
- int dy = 0;
- if (direction & Being::LEFT)
- dx = -5;
- else if (direction & Being::RIGHT)
- dx = 5;
-
- if (direction & Being::UP)
- dy = -5;
- else if (direction & Being::DOWN)
- dy = 5;
- viewport->moveCamera(dx, dy);
- }
- }
+ moveInDirection(direction);
+ }
+}
+
+void Game::moveInDirection(const unsigned char direction)
+{
+ if (!viewport->getCameraMode())
+ {
+ player_node->specialMove(direction);
+ }
+ else
+ {
+ int dx = 0;
+ int dy = 0;
+ if (direction & Being::LEFT)
+ dx = -5;
+ else if (direction & Being::RIGHT)
+ dx = 5;
+
+ if (direction & Being::UP)
+ dy = -5;
+ else if (direction & Being::DOWN)
+ dy = 5;
+ viewport->moveCamera(dx, dy);
}
}