protected override void Initialize() { this.Dock = DockStyle.Fill; //Init camera and dimensions this.worldDimensions = new Rectangle(0, 0, this.Width, this.Height); previousScroll = Mouse.GetState().ScrollWheelValue; zoomIncrement = 0.01f; camera = new Camera(GraphicsDevice.Viewport, (int)worldDimensions.Width * worldSizeMultiplier, (int)worldDimensions.Height * worldSizeMultiplier, 1f); numOfMasses = 80; ContentManager content = new ContentManager(Services); content.RootDirectory = "Content"; massTexture = content.Load <Texture2D>("Image1"); selectedTexture = content.Load <Texture2D>("selectedRing"); spriteBatch = new SpriteBatch(GraphicsDevice); selectedMass = null; lastLMouse = Microsoft.Xna.Framework.Input.ButtonState.Released; lastRMouse = Microsoft.Xna.Framework.Input.ButtonState.Released; //area selection startVector = new Vector2(); //group list objectGroupList = new List <ObjectGroup>(); // Start the animation timer. timer = new Timer(); timer.Interval = 1; timer.Tick += Tick; timer.Start(); //create simulation springSim = new Simulation(this); springSim.Stiffness = stiffness; springSim.Damping = damping; springSim.Length = 10f; springSim.MassPerString = numOfMasses; stringLists = new List <SimString>(); //add forces gravity = new Gravity(new Vector2(0f, 9.81f)); springSim.AddGlobalForceGenerator(gravity); air = new Medium(0.5f); springSim.AddGlobalForceGenerator(air); barrier = new ControlSide(new Rectangle(worldDimensions.X, worldDimensions.Y, worldDimensions.Width * worldSizeMultiplier, worldDimensions.Height * worldSizeMultiplier)); springSim.AddGlobalForceGenerator(barrier); //add integrator integrator = new ForwardEulerIntegrator(this); springSim.Integrator = integrator; parentForm.saveState(); }