Ejemplo n.º 1
0
        public override void LoadContent()
        {
            if (World == null)
            {
                World = new World(Vector2.Zero);
                World.JointRemoved += JointRemoved;
            }
            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();
        }
        public override void LoadContent()
        {
            base.LoadContent();

            if (World == null)
            {
                World = new World(Vector2.Zero);
                World.JointRemoved += JointRemoved;
            }
            else
            {
                World.Clear();
            }

            // enable multithreading
            World.ContactManager.VelocityConstraintsMultithreadThreshold = 256;
            World.ContactManager.PositionConstraintsMultithreadThreshold = 256;
            World.ContactManager.CollideMultithreadThreshold             = 256;

            if (DebugView == null)
            {
                DebugView = new DebugView(World);
                DebugView.RemoveFlags(DebugViewFlags.Shape);
                DebugView.RemoveFlags(DebugViewFlags.Joint);
                DebugView.DefaultShapeColor  = Color.White;
                DebugView.SleepingShapeColor = Color.LightGray;
                DebugView.LoadContent(ScreenManager.GraphicsDevice, ScreenManager.Content);
            }

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

            HiddenBody = World.CreateBody(Vector2.Zero);

            // Loading may take a while... so prevent the game from "catching up" once we finished loading
            ScreenManager.Game.ResetElapsedTime();
        }
Ejemplo n.º 3
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();
        }