简体   繁体   English

按下其他按钮时,MonoGame鼠标按钮状态发生变化

[英]MonoGame mouse button status changes when other button is pressed

I am trying to print the status of the two mouse buttons, in the Update method. 我正在尝试在Update方法中打印两个鼠标按钮的状态。

 MouseState state = Mouse.GetState();
 Console.WriteLine(state.LeftButton + " " + state.RightButton);

Then, when I click left, I get 然后,当我单击左键时,我得到

 Pressed   Released

If I maintain the left, but now click the right, during about one second, the left button is "released" and gets back to "pressed" in a while 如果我保持左侧,但现在单击右侧,则大约一秒钟内,左侧按钮被“释放”并在一段时间内恢复为“按下”状态

Any idea if there is any known bug on this, or any workaround? 知道是否有任何已知的错误或解决方法吗?

It is not bug. 这不是错误。 If you hold left button pressed and press right button. 如果按住左按钮,然后按右按钮。 Behaviour of left button will be pressed, released, pressed. 左按钮的行为将被按下,释放,按下。

It is easy to test it in your browser. 在浏览器中测试它很容易。

1- Press your left button.

Left Button behavior : pressed 左键行为: pressed

2- Press your right button. 

Left Button behavior : released 左键行为:已released

3- In your browser you will see menu items. Bring your cursor to one of them. 

Left Button behavior : pressed 左键行为: pressed

4- Release your left button. 

Left Button behavior : released 左键行为:已released

Result : You will see that you clicked. 结果:您将看到您单击了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM