summaryrefslogtreecommitdiff
path: root/src/gui/gui.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-11-09 01:53:40 +0300
committerAndrei Karas <akaras@inbox.ru>2012-11-12 18:54:58 +0300
commit363223352ee9c4c7c1d65e49cf48b38b538abaf2 (patch)
treefd43f37cdcbe02083ef66fdd54baca3f0c709f0b /src/gui/gui.cpp
parent9d66ae92ac714b4a4b21e588a3e2d481c352cd60 (diff)
downloadplus-363223352ee9c4c7c1d65e49cf48b38b538abaf2.tar.gz
plus-363223352ee9c4c7c1d65e49cf48b38b538abaf2.tar.bz2
plus-363223352ee9c4c7c1d65e49cf48b38b538abaf2.tar.xz
plus-363223352ee9c4c7c1d65e49cf48b38b538abaf2.zip
Moving Android on screen keyboard button from SDL to ManaPlus.
Also add basic functions for handling other on screen buttons.
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r--src/gui/gui.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 956b9e8b3..f0171ede4 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -36,6 +36,7 @@
#include "keydata.h"
#include "keyevent.h"
#include "keyinput.h"
+#include "touchmanager.h"
#include "resources/image.h"
#include "resources/imageset.h"
@@ -395,6 +396,7 @@ void Gui::draw()
BLOCK_START("Gui::draw 1")
mGraphics->pushClipArea(getTop()->getDimension());
getTop()->draw(mGraphics);
+ touchManager.draw();
int mouseX, mouseY;
const uint8_t button = SDL_GetMouseState(&mouseX, &mouseY);
@@ -650,3 +652,43 @@ void Gui::getAbsolutePosition(gcn::Widget *widget, int &x, int &y)
widget = widget->getParent();
}
}
+
+void Gui::handleMouseInput()
+{
+ BLOCK_START("Gui::handleMouseInput")
+ while (!mInput->isMouseQueueEmpty())
+ {
+ const gcn::MouseInput mouseInput = mInput->dequeueMouseInput();
+
+ if (touchManager.processEvent(mouseInput))
+ continue;
+
+ // Save the current mouse state. It will be needed if modal focus
+ // changes or modal mouse input focus changes.
+ mLastMouseX = mouseInput.getX();
+ mLastMouseY = mouseInput.getY();
+
+ switch (mouseInput.getType())
+ {
+ case gcn::MouseInput::PRESSED:
+ handleMousePressed(mouseInput);
+ break;
+ case gcn::MouseInput::RELEASED:
+ handleMouseReleased(mouseInput);
+ break;
+ case gcn::MouseInput::MOVED:
+ handleMouseMoved(mouseInput);
+ break;
+ case gcn::MouseInput::WHEEL_MOVED_DOWN:
+ handleMouseWheelMovedDown(mouseInput);
+ break;
+ case gcn::MouseInput::WHEEL_MOVED_UP:
+ handleMouseWheelMovedUp(mouseInput);
+ break;
+ default:
+ throw GCN_EXCEPTION("Unknown mouse input type.");
+ break;
+ }
+ }
+ BLOCK_END("Gui::handleMouseInput")
+}