Beispiel #1
0
 public static void Update()
 {
     Resolution     = new Vector2(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height);
     LastMouseState = MouseState;
     mouseState     = Mouse.GetState();
     MouseState     = new CommonMouseState(new Vector2(mouseState.X, mouseState.Y), mouseState.LeftButton, mouseState.RightButton, mouseState.ScrollWheelValue - lastScrollWheel);
 }
Beispiel #2
0
 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;
 }