我有用于Windows商店的单游戏(3.4)XAML应用程序(在Win10上为VS2012)。在我游戏的Update()中,我调用了附有代码的代码来接收toutch事件。在Windows 8 / 8.1中,一切正常,但是在Windows 10中,我必须按住按钮并移动鼠标几次才能得到ButtonState.Pressed-对于最终用户,这看起来像鼠标根本不起作用。我该如何管理这个错误?
鼠标事件接收代码:
MouseState st = Mouse.GetState();
if (st.LeftButton == ButtonState.Pressed)
{
if (prevMouseState == ButtonState.Released)
{
prevMouseValX = st.X;
prevMouseValY = st.Y;
pushEvent(EVT_POINTER_DOWN, (int)(st.X - mScrBiasX), (int)(st.Y - mScrBiasY), 1, 0);
}
else
{
if (Math.Abs(st.X - prevMouseValX) > 2 || Math.Abs(st.Y - prevMouseValY) > 2)
pushEvent(EVT_POINTER_MOVE, (int)(st.X - mScrBiasX), (int)(st.Y - mScrBiasY), 1, 0);
}
prevMouseState = ButtonState.Pressed;
}
if (st.LeftButton == ButtonState.Released)
{
if (prevMouseState == ButtonState.Pressed)
{
pushEvent(EVT_POINTER_UP, (int)(st.X - mScrBiasX), (int)(st.Y - mScrBiasY), 1, 0);
}
prevMouseState = ButtonState.Released;
}
最佳答案
答案是使用Monogame的最新开发版本-从源头开始-(并使用VS2013-2015构建win 8.1二进制文件)