Exemple #1
0
        public override void LoadContent()
        {
            if (World == null)
            {
                World = new World(Vector2.Zero);
                World.JointRemoved += JointRemoved;

                // enable multithreading
                World.ContactManager.VelocityConstraintsMultithreadThreshold = 256;
                World.ContactManager.PositionConstraintsMultithreadThreshold = 256;
                World.ContactManager.CollideMultithreadThreshold             = 256;
            }
            else
            {
                World.Clear();
            }

            if (DebugView == null)
            {
                DebugView = new DebugView(World);
                DebugView.DefaultShapeColor  = Color.White;
                DebugView.SleepingShapeColor = Color.LightGray;
                DebugView.LoadContent(Framework.GraphicsDevice, Framework.Content);
            }

            DebugView.Flags = _flags;
            _flagsChanged   = false;

            if (Camera == null)
            {
                Camera = new Camera2D(Framework.GraphicsDevice);
            }
            else
            {
                Camera.ResetCamera();
            }

            base.LoadContent();
        }