summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2005-06-30 21:44:43 +0000
committerYohann Ferreira <bertram@cegetel.net>2005-06-30 21:44:43 +0000
commit7e6684a2236e4a830355fce9fb6e194733021500 (patch)
tree12ee9d9cd35a4cb55c8158760c46e8c20c4b6b52 /src
parent004cec89e306744b3079e72fdb1866579d4b3a26 (diff)
downloadmana-client-7e6684a2236e4a830355fce9fb6e194733021500.tar.gz
mana-client-7e6684a2236e4a830355fce9fb6e194733021500.tar.bz2
mana-client-7e6684a2236e4a830355fce9fb6e194733021500.tar.xz
mana-client-7e6684a2236e4a830355fce9fb6e194733021500.zip
The popup-menu now disappears again when clicking somewhere else. (A little buggy but on its way.)
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp
index b53df444..45ef2ccc 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -458,9 +458,27 @@ void do_input()
}
}
- // Just cancel the popup menu if shown
- //popupMenu->setVisible(false);
- }
+ // Just cancel the popup menu if shown, and don't make the character walk
+ if (popupMenu->isVisible() == true)
+ {
+ // We get the x, y coord of the click
+ int clickX = (mx - camera_x) * 32 + 25;
+ int clickY = (my - camera_y) * 32 + 25;
+
+ // If we click elsewhere than in the window, do not use the event
+ // The user wanted to close the popup.
+ // Still buggy : Wonder if the x, y, width, and height aren't reported partially
+ // with these functions.
+ if ( clickX > (popupMenu->getX() + popupMenu->getWidth()) || clickX < popupMenu->getX()
+ || clickY > (popupMenu->getY() + popupMenu->getHeight()) || clickY < popupMenu->getY() )
+ {
+ used = true;
+ popupMenu->setVisible(false);
+ std::cout << "out" << std::endl;
+ }
+ }
+
+ } // End Mouse left button
// Mouse button middle
else if (event.button.button == SDL_BUTTON_MIDDLE)