From 351b7cf1ff682026485b0e7a8f7623fe356cdf84 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 9 Dec 2012 19:51:15 +0300 Subject: Add resize options for on screen joystick and buttons. --- src/touchactions.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/touchactions.cpp') 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) -- cgit v1.2.3-60-g2f50