コード例 #1
0
        public override void LoadContent()
        {
            var world = EntityWorld.SystemManager.GetSystem<PhysicsSystem>().PhysicsWorld;
            _debugView = new FarseerPhysics.DebugView.DebugViewXNA(world);
            _debugView.LoadContent(ServiceLocator.Instance.GetService<GraphicsDevice>(), ServiceLocator.Instance.GetService<ContentManager>());
            _debugView.Flags = FarseerPhysics.DebugViewFlags.Shape | FarseerPhysics.DebugViewFlags.CenterOfMass;

            var keyboard = ServiceLocator.Instance.GetService<IKeyboardService>();
            keyboard.KeyDown += key =>
            {
                if (key == Microsoft.Xna.Framework.Input.Keys.F11) IsEnabled = !IsEnabled;
            };
            IsEnabled = false;
            base.LoadContent();
        }
コード例 #2
0
        public GDEntityManager(GDGameScreen scrn) : base(scrn)
        {
            PhysicsWorld = new World(Vector2.Zero);

#if DEBUG
            debugView = new FarseerPhysics.DebugView.DebugViewXNA(PhysicsWorld);
            debugView.LoadContent(GDOwner.Graphics.GraphicsDevice, GDOwner.Game.Content, Textures.DebugFont);
            debugView.AppendFlags(DebugViewFlags.Shape);
            debugView.AppendFlags(DebugViewFlags.DebugPanel);
            debugView.AppendFlags(DebugViewFlags.PerformanceGraph);
            debugView.AppendFlags(DebugViewFlags.ContactPoints);
            debugView.AppendFlags(DebugViewFlags.ContactNormals);
            debugView.AppendFlags(DebugViewFlags.Controllers);
            debugView.TextColor = Color.Black;
            debugView.Enabled   = false;
#endif
        }
コード例 #3
0
 public void Initialize()
 {
     RenderTarget = new RenderTarget2D( GraphicsDevice, WIDTH, HEIGHT );
     pixel = new Texture2D( GraphicsDevice, 1, 1 );
     pixel.SetData( new[] { Color.White } );
     #if WINDOWS
     mDebugView = new FarseerPhysics.DebugView.DebugViewXNA( World );
     mDebugView.LoadContent( GraphicsDevice, Game.Content );
     #endif
     World.Step( 0 );
 }