Mail Archives: djgpp/1997/05/19/00:58:43
Ian Pitt wrote:
>
> I am writing a mouse routine using DJGPP but I am having trouble
> implementing detection of a Double Click. Does anybody have any
> suggestions?
If you have timer handler with high resolution (like Allegro's one)
declare global counter tick_counter and do tick_counter++ 'each'
clock cicle, also declare variable last_left_click and set it
to tick_counter value each left mouse click. Befor this assigment
check last_left_click-tick_counter<=dbl_click_time :
long tick_counter
...
timer_handler ()
{ tick_counter++;
...
}
...
mouse_handler ()
{ static last_left_click=tick_counter;
if ((last_left_click-tick_conter)<=dbl_click_time)
{ //dbl click
last_left_click=tick_counter;
return();
}
last_left_click=tick_counter;
}
--
Regards,
Dim Zegebart,
Moscow Russia.
Ghostly basement : http://www.geocities.com/siliconvalley/pines/7817
- Raw text -