protected override void Update(GameTime gameTime) { base.Update(gameTime); Assets.updateTimer.Restart(); #region Process Curtain Simulation //update point masses for (i = 0; i < PointMasses.Count; i++) { Functions_Simulate.Constrain(PointMasses[i]); Functions_Simulate.ApplyPhysics(PointMasses[i]); Functions_Simulate.RelaxPM(PointMasses[i]); } #endregion #region Pass input into curtain //get this frame of user input InputData.Update(); //place cursor rec and draw game cursor MouseState currentMouseState = Mouse.GetState(); cursorRec.X = (int)currentMouseState.X - (int)(cursorRec.Width / 2); cursorRec.Y = (int)currentMouseState.Y - (int)(cursorRec.Height / 2); if (InputData.IsLeftMouseBtnPress()) { //grab one PM colliding with cursor rec for (i = 0; i < PointMasses.Count; i++) { //do not allow input to be passed to pinned point masses if (PointMasses[i].pinned == false) { if (cursorRec.Contains(PointMasses[i].X, PointMasses[i].Y)) { //grab PM, bail grabbedPM = PointMasses[i]; grabbedPM.pinned = true; i = PointMasses.Count; } } } } if (currentMouseState.LeftButton == ButtonState.Pressed) { //handle dragging state (left mouse button down) if (grabbedPM != null) { //drag the point until released grabbedPM.X = currentMouseState.X; grabbedPM.Y = currentMouseState.Y; } } else { //release grabbed pm if (grabbedPM != null) { grabbedPM.pinned = false; grabbedPM = null; } } #endregion //update how the lines connect to their pointMasses for (i = 0; i < Lines.Count; i++) { Functions_Simulate.UpdateLine(Lines[i]); } Assets.updateTimer.Stop(); updateTimeRec.Width = (int)(Assets.updateTimer.ElapsedTicks / 1000 * 8); }