summaryrefslogtreecommitdiff
path: root/src/gui/gui.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-13 14:27:44 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-13 14:27:44 +0000
commit809b072f55b2d419feec8a583f53962f220d4390 (patch)
tree5a4c4950a85b86c34839093a713a2c86044645c0 /src/gui/gui.cpp
parentcd2c4f5861c89f0925a1a706e38535d6c11cc3a0 (diff)
downloadmana-809b072f55b2d419feec8a583f53962f220d4390.tar.gz
mana-809b072f55b2d419feec8a583f53962f220d4390.tar.bz2
mana-809b072f55b2d419feec8a583f53962f220d4390.tar.xz
mana-809b072f55b2d419feec8a583f53962f220d4390.zip
Fixed problem with mouse walking through GUI.
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r--src/gui/gui.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index cf4c5b36..5c77f317 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -24,6 +24,9 @@
#include "gui.h"
#include "window.h"
#include "windowcontainer.h"
+#include "../engine.h"
+#include "../net/protocol.h"
+#include "../main.h"
// Guichan stuff
Gui *gui;
@@ -53,6 +56,7 @@ Gui::Gui(Graphics *graphics):
guiTop = new WindowContainer();
guiTop->setDimension(gcn::Rectangle(0, 0, screen->w, screen->h));
guiTop->setOpaque(false);
+ guiTop->addMouseListener(this);
Window::setWindowContainer(guiTop);
// Create focus handler
@@ -165,3 +169,16 @@ void Gui::focusNone()
{
focusHandler->focusNone();
}
+
+void Gui::mousePress(int mx, int my, int button)
+{
+ // Mouse pressed on window container (basically, the map)
+ int tilex = mx / 32 + camera_x;
+ int tiley = my / 32 + camera_y;
+
+ // Experimental mouse walk support
+ walk(mx, my, 0);
+ player_node->setPath(tiledMap->findPath(
+ player_node->x, player_node->y,
+ tilex, tiley));
+}