[SDL] Double Click

Elmar Krieger elmar at cmbi.ru.nl
Sat May 5 20:53:47 PDT 2007


Peter Ketting wrote:
>>          Do you know if there is an easy way to detect double click,
>> instead of just down or up?
> 
> Check events, etc...
[snip]
> 
> Not tested, but this is how I would do it.
> 
> Cheers,
> Peter

You asked for an easy way and got one from Peter. In practice the 
problems start as soon as your render loop gets heavy load and takes 
longer than a double click, in which case you can't detect the double 
clicks anymore.

In Linux, the workaround is to handle your events in a separate thread. 
For Windows and MacOSX, the only hard way I found was to patch SDL to 
add timestamps to the events, and then use these timestamps to see how 
much time passed between the clicks. These patches are at

http://www.yasara.org/sdl_patches.zip

But that's really the hard solution, if someone knows an easier one, 
please tell me ;-)

Ciao,
Elmar


-- 
Elmar Krieger, PhD
YASARA Biosciences & CMBI Outstation Austria
Neue-Welt-Hoehe 13/b
A-8042 Graz
Austria/Europe

                 Ww
               c(@@)c
================()==OUu============
=WHAT IF YASARA knows the answer?!=
=----- http://www.yasara.org -----=
=- http://www.cmbi.kun.nl/whatif -=
============OOo====================
                () ()
               _/  /_


More information about the SDL mailing list