diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-20 00:58:35 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-20 01:24:45 +0300 |
commit | 91023f53ac00c4fafbf154d0960357e2b131a802 (patch) | |
tree | a066fadd2c40e76fe970178fe932cb1189c36b42 /src/client.cpp | |
parent | fc0bffc8aa066409c4538907fe96f389712e24ff (diff) | |
download | manaplus-91023f53ac00c4fafbf154d0960357e2b131a802.tar.gz manaplus-91023f53ac00c4fafbf154d0960357e2b131a802.tar.bz2 manaplus-91023f53ac00c4fafbf154d0960357e2b131a802.tar.xz manaplus-91023f53ac00c4fafbf154d0960357e2b131a802.zip |
add option for input logging.
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp index 0f02375a1..85a224b41 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -2768,3 +2768,73 @@ void Client::logVars() logger->log("DATADIR2: %s", getenv("DATADIR2")); #endif } + +void Client::logEvent(const SDL_Event &event) +{ + switch (event.type) + { + case SDL_MOUSEMOTION: + logger->log("event: SDL_MOUSEMOTION: %d,%d,%d", + event.motion.state, event.motion.x, event.motion.y); + break; + case SDL_KEYDOWN: + logger->log("event: SDL_KEYDOWN: %d,%d,%d", event.key.state, + event.key.keysym.scancode, event.key.keysym.unicode); + break; + case SDL_KEYUP: + logger->log("event: SDL_KEYUP: %d,%d,%d", event.key.state, + event.key.keysym.scancode, event.key.keysym.unicode); + break; + case SDL_MOUSEBUTTONDOWN: + logger->log("event: SDL_MOUSEBUTTONDOWN: %d,%d,%d,%d", + event.button.button, event.button.state, + event.button.x, event.button.y); + break; + case SDL_MOUSEBUTTONUP: + logger->log("event: SDL_MOUSEBUTTONUP: %d,%d,%d,%d", + event.button.button, event.button.state, + event.button.x, event.button.y); + break; + case SDL_JOYAXISMOTION: + logger->log("event: SDL_JOYAXISMOTION: %d,%d,%d", + event.jaxis.which, event.jaxis.axis, event.jaxis.value); + break; + case SDL_JOYBALLMOTION: + logger->log("event: SDL_JOYBALLMOTION: %d,%d,%d,%d", + event.jball.which, event.jball.ball, + event.jball.xrel, event.jball.yrel); + break; + case SDL_JOYHATMOTION: + logger->log("event: SDL_JOYHATMOTION: %d,%d,%d", event.jhat.which, + event.jhat.hat, event.jhat.value); + break; + case SDL_JOYBUTTONDOWN: + logger->log("event: SDL_JOYBUTTONDOWN: %d,%d,%d", + event.jbutton.which, event.jbutton.button, + event.jbutton.state); + break; + case SDL_JOYBUTTONUP: + logger->log("event: SDL_JOYBUTTONUP: %d,%d,%d", + event.jbutton.which, event.jbutton.button, + event.jbutton.state); + break; + case SDL_QUIT: + logger->log("event: SDL_QUIT"); + break; + case SDL_SYSWMEVENT: + logger->log("event: SDL_SYSWMEVENT"); + break; + case SDL_VIDEORESIZE: + logger->log("event: SDL_VIDEORESIZE"); + break; + case SDL_VIDEOEXPOSE: + logger->log("event: SDL_VIDEOEXPOSE"); + break; + case SDL_USEREVENT: + logger->log("event: SDL_USEREVENT"); + break; + default: + logger->log("event: other: %d", event.type); + break; + }; +} |