diff options
-rw-r--r-- | src/touchactions.cpp | 21 | ||||
-rw-r--r-- | src/touchactions.h | 16 |
2 files changed, 18 insertions, 19 deletions
diff --git a/src/touchactions.cpp b/src/touchactions.cpp index b9d6b2fc9..df18fd366 100644 --- a/src/touchactions.cpp +++ b/src/touchactions.cpp @@ -35,16 +35,15 @@ bool padClicked(false); -#ifdef ANDROID -void showKeyboard(const MouseInput &mouseInput A_UNUSED) +#define impHandler(name) void name(const MouseInput &mouseInput) +#define impHandler0(name) void name(const MouseInput &mouseInput A_UNUSED) + +impHandler0(showKeyboard) { +#ifdef ANDROID SDL_ANDROID_ToggleScreenKeyboardTextInput(nullptr); -} -#else -void showKeyboard(const MouseInput &mouseInput A_UNUSED) -{ -} #endif +} static void moveChar(int x, int y) { @@ -112,13 +111,13 @@ static void moveChar(int x, int y) } } -void padClick(const MouseInput &mouseInput) +impHandler(padClick) { moveChar(mouseInput.getX(), mouseInput.getY()); padClicked = true; } -void padEvents(const MouseInput &mouseInput) +impHandler(padEvents) { if (mouseInput.getType() == gcn::MouseInput::MOVED) { @@ -127,13 +126,13 @@ void padEvents(const MouseInput &mouseInput) } } -void padOut(const MouseInput &mouseInput A_UNUSED) +impHandler0(padOut) { padClicked = false; moveChar(50, 50); } -void padUp(const MouseInput &mouseInput A_UNUSED) +impHandler0(padUp) { padClicked = false; moveChar(50, 50); diff --git a/src/touchactions.h b/src/touchactions.h index e76836a7f..080f02c6f 100644 --- a/src/touchactions.h +++ b/src/touchactions.h @@ -25,16 +25,16 @@ #include "localconsts.h" -class MouseInput; - -void showKeyboard(const MouseInput &mouseInput); +#define decHandler(name) void name(const MouseInput &mouseInput) -void padClick(const MouseInput &mouseInput); - -void padEvents(const MouseInput &mouseInput); +class MouseInput; -void padOut(const MouseInput &mouseInput); +decHandler(showKeyboard); +decHandler(padClick); +decHandler(padEvents); +decHandler(padOut); +decHandler(padUp); -void padUp(const MouseInput &mouseInput); +#undef decHandler #endif |