Ejemplo n.º 1
0
 private void InitializePhysics()
 {
     Simulation = _configuration.CreateSimulation(this);
     VerifySimulation();
     _boxShooter = new BoxShooter(Simulation.World);
     _bodyPicker = new BodyPicker(this);
     if (_debugDrawer != null)
     {
         Simulation.World.DebugDrawer = _debugDrawer;
     }
 }
Ejemplo n.º 2
0
        public void Run()
        {
            using (Graphics = GraphicsLibraryManager.GetGraphics(this))
            {
                Input    = new Input(Graphics.Form);
                Freelook = new FreeLook(Input);

                _bodyPicker = new BodyPicker(this);

                Graphics.Initialize();
                Graphics.CullingEnabled = isCullingEnabled;
                OnInitialize();
                if (World == null)
                {
                    OnInitializePhysics();
                }
                if (_isDebugDrawEnabled)
                {
                    if (_debugDrawer == null)
                    {
                        _debugDrawer           = Graphics.GetPhysicsDebugDrawer();
                        _debugDrawer.DebugMode = DebugDrawMode;
                    }
                    if (World != null)
                    {
                        World.DebugDrawer = _debugDrawer;
                    }
                }
                Graphics.UpdateView();
                SetInfoText();

                Graphics.Run();

                if (_debugDrawer != null)
                {
                    if (World != null)
                    {
                        World.DebugDrawer = null;
                    }
                    if (_debugDrawer is IDisposable)
                    {
                        (_debugDrawer as IDisposable).Dispose();
                    }
                    _debugDrawer = null;
                }
            }
            Graphics = null;
        }