diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-03 00:00:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-03 00:00:28 +0300 |
commit | e9301ddce5a6ddf77dafc1f56f0b1461b2092c6f (patch) | |
tree | c9a1ed0ef0d9b15a1b3d617f9a17999bed768ff7 /src/gui/sdlinput.cpp | |
parent | 0b228c1ed05177a761dce44df31f087c0313dc64 (diff) | |
download | ManaVerse-e9301ddce5a6ddf77dafc1f56f0b1461b2092c6f.tar.gz ManaVerse-e9301ddce5a6ddf77dafc1f56f0b1461b2092c6f.tar.bz2 ManaVerse-e9301ddce5a6ddf77dafc1f56f0b1461b2092c6f.tar.xz ManaVerse-e9301ddce5a6ddf77dafc1f56f0b1461b2092c6f.zip |
Add support for relative mouse move in android version.
Diffstat (limited to 'src/gui/sdlinput.cpp')
-rw-r--r-- | src/gui/sdlinput.cpp | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index a79752cba..32aff02c9 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -58,9 +58,9 @@ #include "gui/sdlinput.h" -#include "keydata.h" - #include "inputmanager.h" +#include "keydata.h" +#include "mouseinput.h" #include <guichan/exception.hpp> @@ -108,10 +108,25 @@ gcn::MouseInput SDLInput::dequeueMouseInput() return mouseInput; } +MouseInput SDLInput::dequeueMouseInput2() +{ + MouseInput mouseInput; + + if (mMouseInputQueue.empty()) + { + throw GCN_EXCEPTION("The queue is empty."); + } + + mouseInput = mMouseInputQueue.front(); + mMouseInputQueue.pop(); + + return mouseInput; +} + void SDLInput::pushInput(const SDL_Event &event) { KeyInput keyInput; - gcn::MouseInput mouseInput; + MouseInput mouseInput; switch (event.type) { @@ -153,6 +168,9 @@ void SDLInput::pushInput(const SDL_Event &event) mMouseDown = true; mouseInput.setX(event.button.x); mouseInput.setY(event.button.y); +#ifdef ANDROID + mouseInput.setReal(event.button.realx, event.button.realy); +#endif mouseInput.setButton(convertMouseButton(event.button.button)); if (event.button.button == SDL_BUTTON_WHEELDOWN) @@ -169,6 +187,9 @@ void SDLInput::pushInput(const SDL_Event &event) mMouseDown = false; mouseInput.setX(event.button.x); mouseInput.setY(event.button.y); +#ifdef ANDROID + mouseInput.setReal(event.button.realx, event.button.realy); +#endif mouseInput.setButton(convertMouseButton(event.button.button)); mouseInput.setType(gcn::MouseInput::RELEASED); mouseInput.setTimeStamp(SDL_GetTicks()); @@ -178,6 +199,9 @@ void SDLInput::pushInput(const SDL_Event &event) case SDL_MOUSEMOTION: mouseInput.setX(event.button.x); mouseInput.setY(event.button.y); +#ifdef ANDROID + mouseInput.setReal(event.button.realx, event.button.realy); +#endif mouseInput.setButton(gcn::MouseInput::EMPTY); mouseInput.setType(gcn::MouseInput::MOVED); mouseInput.setTimeStamp(SDL_GetTicks()); |