From f97e5ee9c22cccfb27a3634e814ad9b01edc3195 Mon Sep 17 00:00:00 2001 From: Stefan Dombrowski Date: Tue, 2 Nov 2010 10:42:39 +0100 Subject: Adding double-click to server dialog and world select dialog This resolves http://bugs.manasource.org/view.php?id=259 Reviewed-by: Thorbjorn --- src/client.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/client.cpp') 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 { -- cgit v1.2.3-70-g09d2