/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { //if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) // Exit(); if (ScreenInfo.Default.HasMouse) { lastMouseState = Mouse.GetState(); if (graphics.GraphicsDevice.Viewport.Bounds.Contains(lastMouseState.X, lastMouseState.Y)) { // Update our sprites position to the current cursor location mousePosition.X = lastMouseState.X; mousePosition.Y = lastMouseState.Y; } master.Update(new UpdateContext(gameTime, lastMouseState, touchState: null, lastMouseState.AsPoint(), Globals.ObjectPool)); } else { var touchCollection = TouchPanel.GetState(); var touchState = new TouchState(touchCollection, lastTouchStateTrackingId); master.Update(new UpdateContext(gameTime, mouseState: null, touchState, touchState.Position, Globals.ObjectPool)); lastTouchStateTrackingId = touchState.TrackingId; } base.Update(gameTime); }