如何在单击鼠标并按住某个键时触发事件?(How to trigger event when mouse is clicked AND a key is held down?)

编程入门 行业动态 更新时间:2024-10-27 18:30:34
如何在单击鼠标并按住某个键时触发事件?(How to trigger event when mouse is clicked AND a key is held down?)

在glutMouseFunc内部有没有办法检测键是否被按下?

Is there any way to detect if a key is being held down while inside of the glutMouseFunc?

最满意答案

是。 存储全局可访问的列表,列出当前按下的键。 然后在MouseFunc中读取该列表。

请注意,鼠标回调已经获得控制键状态(shift / alt / ctrl),因此您通常不需要这样做。

Yes. Store a globally-accessible list of what keys are currently held down. Then read that list in your MouseFunc.

Note that the mouse callback already gets the control key state (shift/alt/ctrl), so you generally don't need to do this.

更多推荐

本文发布于:2023-04-29 12:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336435.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:鼠标   单击   事件   如何在   trigger

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!