双击,如何处理? [英] Double click, how handle it?

查看:112
本文介绍了双击,如何处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出如何用鼠标左键(或任意键)双击. 但是我找不到有关它的任何信息.

I was trying to find out how handle double click with left(or any) mouse button. But I can't find any information about it.

有人可以帮助我吗?我不想编写自己的双击处理程序.

Can anybody help me? I don't want to write my own double click handler.

GLFW_REPEAT不适用于鼠标按钮.

GLFW_REPEAT doesn't work with mouse buttons.

推荐答案

编写自己的双击处理程序有什么问题?

What's so wrong about writing your own double click handler?

只需保存鼠标单击发生的时间,例如使用std::chrono::high_resolution_clock::now(),并在下次单击鼠标时比较时间.如果该值低于特定值,则会发生双击.

Just save the time the mouse click happens, e.g. with std::chrono::high_resolution_clock::now(), and when the next mouse click happens, compare the times. If it is under a specific value, a double click happened.

这篇关于双击,如何处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆