summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2010-11-02 10:42:39 +0100
committerStefan Dombrowski <stefan@uni-bonn.de>2010-11-02 10:42:39 +0100
commitf97e5ee9c22cccfb27a3634e814ad9b01edc3195 (patch)
tree36b0a35977b5214e746b12f1ebc6fbf347bc5aa3 /src/client.cpp
parent526741f2651990e8a89113f750d2bf274d88f33f (diff)
downloadmana-f97e5ee9c22cccfb27a3634e814ad9b01edc3195.tar.gz
mana-f97e5ee9c22cccfb27a3634e814ad9b01edc3195.tar.bz2
mana-f97e5ee9c22cccfb27a3634e814ad9b01edc3195.tar.xz
mana-f97e5ee9c22cccfb27a3634e814ad9b01edc3195.zip
Adding double-click to server dialog and world select dialog
This resolves http://bugs.manasource.org/view.php?id=259 Reviewed-by: Thorbjorn
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 66a1f28c..975e3e05 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -172,6 +172,22 @@ int get_elapsed_time(int start_time)
* MILLISECONDS_IN_A_TICK;
}
+bool isDoubleClick(int selected)
+{
+ const Uint32 maximumDelay = 500;
+ static Uint32 lastTime = 0;
+ static int lastSelected = -1;
+
+ if (selected == lastSelected && lastTime + maximumDelay >= SDL_GetTicks())
+ {
+ lastTime = 0;
+ return true;
+ }
+
+ lastTime = SDL_GetTicks();
+ lastSelected = selected;
+ return false;
+}
// This anonymous namespace hides whatever is inside from other modules.
namespace {