public static void Update(Game game) { Resolution = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); touchCollection = TouchPanel.GetState(game.Window).GetState(); touchLocations = touchCollection.ToArray(); LastMouseState = MouseState; mouseState = Mouse.GetState(); if (mouseState.Position != default) { MouseState = new CommonMouseState(mouseState.Position.ToVector2(), mouseState.LeftButton, mouseState.RightButton, mouseState.ScrollWheelValue - lastScrollWheel); } else { if (touchLocations.Length == 0) { MouseState = new CommonMouseState(MouseState.position, ButtonState.Released, ButtonState.Released, 0); } else { MouseState = new CommonMouseState(touchLocations[0].Position, touchLocations.Length == 1 ? ButtonState.Pressed : ButtonState.Released, touchLocations.Length == 1 ? ButtonState.Released : ButtonState.Pressed, 0); } } lastScrollWheel = mouseState.ScrollWheelValue; }