【问题标题】:MonoGame mouse button status changes when other button is pressed当按下其他按钮时,MonoGame 鼠标按钮状态会发生变化
【发布时间】:2015-04-21 14:54:29
【问题描述】:

我正在尝试在 Update 方法中打印两个鼠标按钮的状态。

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

然后,当我单击左键时,我得到

 Pressed   Released

如果我保持左侧,但现在单击右侧,大约一秒钟内,左侧按钮被“释放”并在一段时间内恢复为“按下”

知道这方面是否有任何已知的错误或任何解决方法吗?

【问题讨论】:

    标签: c# xna mouse monogame


    【解决方案1】:

    这不是错误。如果按住左键并按下右键。左键的行为将被按下、释放、按下。

    在浏览器中测试它很容易。

    1- Press your left button.
    

    左键行为:pressed

    2- Press your right button. 
    

    左键行为:released

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

    左键行为:pressed

    4- Release your left button. 
    

    左键行为:released

    结果:你会看到你点击了。

    【讨论】:

    • 所以,您说这是鼠标在全球范围内工作的问题,而不是 MonoGame/XNA 特有的问题。该死!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-29
    相关资源
    最近更新 更多