summaryrefslogtreecommitdiff
path: root/src/touchactions.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-09 19:51:15 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-09 21:03:32 +0300
commit351b7cf1ff682026485b0e7a8f7623fe356cdf84 (patch)
tree69e4863afbcf3bddf19affecb53ad0205e3f45a3 /src/touchactions.cpp
parentb43ed947efd36471a0608d103faed95e61f7b124 (diff)
downloadmv-351b7cf1ff682026485b0e7a8f7623fe356cdf84.tar.gz
mv-351b7cf1ff682026485b0e7a8f7623fe356cdf84.tar.bz2
mv-351b7cf1ff682026485b0e7a8f7623fe356cdf84.tar.xz
mv-351b7cf1ff682026485b0e7a8f7623fe356cdf84.zip
Add resize options for on screen joystick and buttons.
Diffstat (limited to 'src/touchactions.cpp')
-rw-r--r--src/touchactions.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/touchactions.cpp b/src/touchactions.cpp
index c88a25cf8..84b6e0942 100644
--- a/src/touchactions.cpp
+++ b/src/touchactions.cpp
@@ -37,6 +37,7 @@
InputEvent tempEvent(0, 0);
bool padClicked(false);
+int haldJoyPad = 50;
#define impHandler(name) void name(const MouseInput &mouseInput)
#define impHandler0(name) void name(const MouseInput &mouseInput A_UNUSED)
@@ -48,6 +49,12 @@ impHandler0(showKeyboard)
#endif
}
+void setHalfJoyPad(int s)
+{
+ logger->log("set size: %d", s);
+ haldJoyPad = s;
+}
+
static void moveChar(int x, int y)
{
Game *const game = Game::instance();
@@ -58,8 +65,8 @@ static void moveChar(int x, int y)
static const int diff = 20;
// set center at (0,0)
- x -= 50;
- y -= 50;
+ x -= haldJoyPad;
+ y -= haldJoyPad;
// some magic for checking at what sector was click
if (abs(x) < lim1)
@@ -132,13 +139,13 @@ impHandler(padEvents)
impHandler0(padOut)
{
padClicked = false;
- moveChar(50, 50);
+ moveChar(haldJoyPad, haldJoyPad);
}
impHandler0(padUp)
{
padClicked = false;
- moveChar(50, 50);
+ moveChar(haldJoyPad, haldJoyPad);
}
impHandler0(attackClick)