Ejemplo n.º 1
0
        protected override void LoadContent()
        {
            dataFont = Content.Load <SpriteFont>("DataFont");
            tinyFont = Content.Load <SpriteFont>("TinyFont");

            controlsMenu = Content.Load <Texture2D>("bepuphysicscontrols");

            IsFixedTimeStep = false;

            LineDrawer = new BasicEffect(GraphicsDevice);

            UIDrawer = new SpriteBatch(GraphicsDevice);

            DataTextDrawer = new TextDrawer(UIDrawer, dataFont, Color.White);
            TinyTextDrawer = new TextDrawer(UIDrawer, tinyFont, Color.White);

            Mouse.SetPosition(200, 200);

            ModelDrawer.Clear();
            ConstraintDrawer.Clear();

            if (ServerSimulation != null)
            {
                ServerSimulation.CleanUp();
            }

            Type SimulationType = typeof(WorldSimulator);

            Globals.world    = (WorldSimulator)Activator.CreateInstance(SimulationType, new object[] { this });
            ServerSimulation = Globals.world;

            foreach (Entity e in Globals.space.Entities)
            {
                if ((string)e.Tag != "noDisplayObject")
                {
                    ModelDrawer.Add(e);
                }
                else
                {
                    e.Tag = null;
                }
            }
            for (int i = 0; i < Globals.space.Solver.SolverUpdateables.Count; i++)
            {
                //Add the solver updateable and match up the activity setting.
                LineDisplayObjectBase objectAdded = ConstraintDrawer.Add(Globals.space.Solver.SolverUpdateables[i]);
                if (objectAdded != null)
                {
                    objectAdded.IsDrawing = Globals.space.Solver.SolverUpdateables[i].IsActive;
                }
            }

            GC.Collect();
        }
Ejemplo n.º 2
0
        protected override void LoadContent()
        {
            dataFont = Content.Load <SpriteFont>("DataFont");
            tinyFont = Content.Load <SpriteFont>("TinyFont");

            controlsMenu = Content.Load <Texture2D>("bepuphysicscontrols");

            IsFixedTimeStep = false;

            LineDrawer = new BasicEffect(GraphicsDevice);

            UIDrawer = new SpriteBatch(GraphicsDevice);

            DataTextDrawer = new TextDrawer(UIDrawer, dataFont, Color.White);
            TinyTextDrawer = new TextDrawer(UIDrawer, tinyFont, Color.White);

#if WINDOWS
            Mouse.SetPosition(200, 200); //This helps the camera stay on track even if the mouse is offset during startup.
#endif

            SwitchSimulation(1);
        }