diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-07 15:22:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-07 15:22:40 +0300 |
commit | 422d65e9407eb9a7ed18b894ad665a7925397ebf (patch) | |
tree | 8a6427f5c109c9d515a999c24872d9909b3c5c91 /src | |
parent | f58c1facbc01fe0c6689d795f43533a6e85a0041 (diff) | |
download | mv-422d65e9407eb9a7ed18b894ad665a7925397ebf.tar.gz mv-422d65e9407eb9a7ed18b894ad665a7925397ebf.tar.bz2 mv-422d65e9407eb9a7ed18b894ad665a7925397ebf.tar.xz mv-422d65e9407eb9a7ed18b894ad665a7925397ebf.zip |
improve touch events logging in SDL2.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/src/client.cpp b/src/client.cpp index 6a01838e7..8762a0456 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -2943,25 +2943,43 @@ void Client::logEvent(const SDL_Event &event) case SDL_FINGERDOWN: { const SDL_TouchFingerEvent &touch = event.tfinger; + const int w = mainGraphics->mWidth; + const int h = mainGraphics->mHeight; logger->log("event: SDL_FINGERDOWN: %lld,%lld (%f,%f) (%f,%f)", - touch.touchId, touch.fingerId, touch.x, touch.y, - touch.dx, touch.dy); + touch.touchId, touch.fingerId, touch.x * w, touch.y * w, + touch.dx * w, touch.dy * h); break; } case SDL_FINGERUP: { const SDL_TouchFingerEvent &touch = event.tfinger; + const int w = mainGraphics->mWidth; + const int h = mainGraphics->mHeight; logger->log("event: SDL_FINGERUP: %lld,%lld (%f,%f) (%f,%f)", - touch.touchId, touch.fingerId, touch.x, touch.y, - touch.dx, touch.dy); + touch.touchId, touch.fingerId, touch.x * w, touch.y * h, + touch.dx * w, touch.dy * h); break; } case SDL_FINGERMOTION: { const SDL_TouchFingerEvent &touch = event.tfinger; + const int w = mainGraphics->mWidth; + const int h = mainGraphics->mHeight; logger->log("event: SDL_FINGERMOTION: %lld,%lld (%f,%f) (%f,%f)", - touch.touchId, touch.fingerId, touch.x, touch.y, - touch.dx, touch.dy); + touch.touchId, touch.fingerId, + touch.x * w, touch.y * h, + touch.dx * w, touch.dy * h); + break; + } + case SDL_MULTIGESTURE: + { + const SDL_MultiGestureEvent &gesture = event.mgesture; + const int w = mainGraphics->mWidth; + const int h = mainGraphics->mHeight; + logger->log("event: SDL_MULTIGESTURE: %lld %f,%f (%f,%f) %d,%d", + gesture.touchId, gesture.dTheta, gesture.dDist, + gesture.x * w, gesture.y * h, (int)gesture.numFingers, + (int)gesture.padding); break; } case SDL_KEYDOWN: @@ -3011,8 +3029,14 @@ void Client::logEvent(const SDL_Event &event) break; } case SDL_TEXTINPUT: - logger->log("event: SDL_TEXTINPUT: %s", event.text.text); + { + const char *const text = event.text.text; + logger->log("event: SDL_TEXTINPUT: %s", text); + const int sz = strlen(event.text.text); + for (int f = 0; f < sz; f ++) + logger->log("dec: %d", text[f]); break; + } case SDL_APP_TERMINATING: logger->log("SDL_APP_TERMINATING"); break; @@ -3028,6 +3052,9 @@ void Client::logEvent(const SDL_Event &event) case SDL_APP_DIDENTERFOREGROUND: logger->log("SDL_APP_DIDENTERFOREGROUND"); break; + case SDL_APP_DIDENTERBACKGROUND: + logger->log("SDL_APP_DIDENTERBACKGROUND"); + break; #else case SDL_KEYDOWN: logger->log("event: SDL_KEYDOWN: %d,%d,%d", event.key.state, |