Exemplo n.º 1
0
        private void TimerTick(object sender, EventArgs e)
        {
            // TODO: remove Testbed-related logic from here

            // PreUpdate interaction services
            foreach (IService service in Testbed.interactionServices)
            {
                service.PreUpdate();
            }

            // Update physics
            pauseStepFrame++;
            Testbed.paused = true;

            if (pauseStepButton.Capture && pauseStepFrame % 20 == 0 && pauseStepFrame > 0)
            {
                Testbed.Update();
            }
            else if (runButton.Capture || runCheckBox.Checked)
            {
                Testbed.paused = false;
                Testbed.Update();
            }
            else
            {
                // Apply the drag force, even if we are paused
                foreach (LsmBody body in Testbed.world.bodies) // TODO: fix this HACK
                {
                    Testbed.dragParticle.ApplyForce(body.particles);
                }
            }

            // PostUpdate interaction services
            foreach (IService service in Testbed.interactionServices)
            {
                service.PostUpdate();
            }

            // Update presentation
            this.Render();
            UpdatePanels();
        }
Exemplo n.º 2
0
 private void pauseStepButton_MouseDown(object sender, MouseEventArgs e)
 {
     pauseStepFrame = 0;
     Testbed.Update();
 }