public override void LoadContent()
        {
            base.LoadContent();

            if (World == null)
                World = new World(Vector2.Zero);
            else
                World.Clear();

            if (DebugView == null)
            {
                DebugView = new DebugViewXNA(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 = BodyFactory.CreateBody(World, Vector2.Zero);

            // Loading may take a while... so prevent the game from "catching up" once we finished loading
            ScreenManager.Game.ResetElapsedTime();
        }
        public override void LoadContent()
        {
            if (World == null)
                World = new World(Vector2.Zero);
            else
                World.Clear();

            if (DebugView == null)
            {
                DebugView = new DebugViewXNA(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();
        }
 protected PhysicsGameScreen()
 {
     TransitionOnTime = TimeSpan.FromSeconds(0.75);
     TransitionOffTime = TimeSpan.FromSeconds(0.75);
     HasCursor = true;
     EnableCameraControl = true;
     _userAgent = null;
     World = null;
     Camera = null;
     DebugView = null;
 }
Example #4
0
        public DebugView(World _world, Game1 game, float _ratio)
        {
            _debugView = new DebugViewXNA(_world);
            _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.DebugPanel);
            _debugView.DefaultShapeColor = Color.Red;
            _debugView.SleepingShapeColor = Color.DarkRed;
            _debugView.LoadContent(game.GraphicsDevice, game.Content);
            _debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Shape);
            //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.PerformanceGraph);
            //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.AABB);
            //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.CenterOfMass);
            //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.ContactNormals);
            //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.ContactPoints);
            //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Controllers);
            //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.Joint);
            //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.PolygonPoints);
            //
            //_debugView.AppendFlags(FarseerPhysics.DebugViewFlags.PolygonPoints);

            this.game = game;
            this._ratio = _ratio;
            Enabled = true;
        }
Example #5
0
 public virtual void Initialize()
 {
     Settings.EnableDiagnostics = true;
     DebugView = new DebugViewXNA(World);
     DebugView.LoadContent(GameInstance.GraphicsDevice, GameInstance.Content);
 }
        public override void LoadContent()
        {
            base.LoadContent();

            //We enable diagnostics to show get values for our performance counters.
            Settings.EnableDiagnostics = true;

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

            if (DebugView == null)
            {
                DebugView = new DebugViewXNA(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();
            }

            // Loading may take a while... so prevent the game from "catching up" once we finished loading
            ScreenManager.Game.ResetElapsedTime();
        }
Example #7
0
 public virtual void Initialize()
 {
     DebugView = new DebugViewXNA(World);
     DebugView.LoadContent(GameInstance.GraphicsDevice, GameInstance.Content);
 }
Example #8
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            background = Content.Load<Texture2D>("sky");
            foreground = Content.Load<Texture2D>("nearback");
            world = new World(new Vector2(0, 1f));

            debugView = new DebugViewXNA(world);
            camera = new Camera(this);
            camera.Position = new Vector2(22,20);
            debugView.LoadContent(GraphicsDevice, Content);

            playerController.LoadContent();
            badger = new ScrapBadger(this, new Vector2(23, 4));

            badger.Rotate(20f * 0.0174532925f);

            crate = new Crate(this, new Vector2(26, 2));
            //XmlLoader loader = new XmlLoader();
            //loader.LoadLevel(ref entityList);

            terrain.LoadContent();
            terrain.CreateGround(world);

            //Init();
        }
Example #9
0
        private void InitDebugDraw()
        {
            debugProjMat = Matrix.CreateOrthographicOffCenter(0f, gameDimensions.X, 0f, gameDimensions.Y, 0f, 1f);
            debugViewMat = Matrix.Identity;

            DebugView = new DebugViewXNA (world);
            DebugView.DefaultShapeColor = Color.White;
            DebugView.SleepingShapeColor = Color.LightGray;
            DebugView.LoadContent (GraphicsDevice, Content);
        }