Search code examples
c#xamlwindows-store-appswindows-10monogame

Monogame mouse in windows 10 feels press only after move


I have monogame (3.4) XAML application for windows store (VS2012 on Win10). In my game's Update() I call attched code to receive toutch events. In windows 8/8.1 everything worked, but in windows 10 I have to hold button and move mouse several times to get ButtonState.Pressed - for end user this looks like mouse doesn't work at all. How can I manage this bug?

Mouse event receive code:

        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;
        }

Solution

  • The answer is to use the last development version of Monogame - from sources - (and build win 8.1 binaries using VS2013-2015)