Beispiel #1
0
 private void Reset_Click(object sender, EventArgs e)
 {
     timer.Stop();
     MainFile.Reset();
     started         = false;
     ObjCounter.Text = Convert.ToString(MainFile.Calculator.bodies.Count);
     Refresh();
 }
Beispiel #2
0
 private void tick(object sender, EventArgs e)
 {
     timer.Stop();
     FPS.Stop();
     elapsed         = FPS.Elapsed;
     FPSCounter.Text = Convert.ToString(Math.Round(1000.0 / elapsed.TotalMilliseconds, 2));
     MainFile.NextStep();
     ObjCounter.Text = Convert.ToString(MainFile.Calculator.bodies.Count);
     Refresh();
     FPS = Stopwatch.StartNew();
     timer.Start();
 }
Beispiel #3
0
 private void Start_Click(object sender, EventArgs e)
 {
     if (IntMethod.SelectedIndex == -1)
     {
         MessageBox.Show("Please select integration method.");
         return;
     }
     if (SimMethod.SelectedIndex == -1)
     {
         MessageBox.Show("Please select simulation method.");
         return;
     }
     MainFile.StartSim((IntMethod.SelectedIndex == 0 ? true : false), (SimMethod.SelectedIndex == 0 ? false : true));
 }
Beispiel #4
0
 private void Canvas_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         if (!started)
         {
             if (!(m0 == 0))
             {
                 var relPoint = PointToClient(Cursor.Position);
                 MainFile.AddBody(relPoint.X * 100, relPoint.Y * 100, vx0, vy0, m0, rng.Next(1, 64));
                 ObjCounter.Text = Convert.ToString(MainFile.preloadbodies.Count);
                 Refresh();
             }
         }
         else
         {
             var relPoint = PointToClient(Cursor.Position);
             MainFile.Calculator.AddBody(new Body(relPoint.X * 100, relPoint.Y * 100, vx0, vy0, m0, rng.Next(1, 64)));
         }
     }
 }