Beispiel #1
0
        public override void DrawDebugData(SpriteBatch batch)
        {
            base.DrawDebugData(batch);

            if (useDebugDraw)
            {
                if (firstTime)
                {
                    _debugDraw = new V2DRuntime.Debug.DebugDraw();
                    _debugDraw.AppendFlags(DebugDrawFlags.AABB | DebugDrawFlags.CenterOfMass | DebugDrawFlags.Joint | DebugDrawFlags.Pair | DebugDrawFlags.Shape);
                    world.DebugDraw   = _debugDraw;
                    simpleColorEffect = new BasicEffect(batch.GraphicsDevice);
                    simpleColorEffect.VertexColorEnabled = true;
                    simpleColorEffect.Projection         = Matrix.CreateOrthographicOffCenter(0, ClientSize.X / WorldScale, ClientSize.Y / WorldScale, 0, -1, 1);

                    V2DRuntime.Debug.DebugDraw._batch  = batch;
                    V2DRuntime.Debug.DebugDraw._device = batch.GraphicsDevice;
                    firstTime = false;
                }

                simpleColorEffect.Techniques[0].Passes[0].Apply();
                batch.Begin(
                    SpriteSortMode.Deferred,
                    BlendState.AlphaBlend, //BlendState.NonPremultiplied,
                    null,                  //SamplerState.AnisotropicClamp,
                    null,                  //DepthStencilState.None,
                    null,                  //RasterizerState.CullNone,
                    simpleColorEffect,
                    Stage.SpriteBatchMatrix);
                _debugDraw.FinishDrawShapes();
                batch.End();
            }
        }
Beispiel #2
0
        //public override void DestroyElement(DisplayObject obj)
        //{
        //    base.DestroyElement(obj);
        //    if (obj is V2DSprite)
        //    {
        //        DestroyBody(((V2DSprite)obj).body);
        //    }
        //}
        //#endif

        #endregion Other

        #if !XBOX360

        public override void DrawDebugData(SpriteBatch batch)
        {
            base.DrawDebugData(batch);

            if (useDebugDraw)
            {
                if (firstTime)
                {
                    _debugDraw = new V2DRuntime.Debug.DebugDraw();
                    _debugDraw.AppendFlags(DebugDrawFlags.AABB | DebugDrawFlags.CenterOfMass | DebugDrawFlags.Joint | DebugDrawFlags.Pair | DebugDrawFlags.Shape);
                    world.DebugDraw = _debugDraw;
                    simpleColorEffect = new BasicEffect(batch.GraphicsDevice);
                    simpleColorEffect.VertexColorEnabled = true;
                    simpleColorEffect.Projection = Matrix.CreateOrthographicOffCenter(0, ClientSize.X / WorldScale, ClientSize.Y / WorldScale, 0, -1, 1);

                    V2DRuntime.Debug.DebugDraw._batch = batch;
                    V2DRuntime.Debug.DebugDraw._device = batch.GraphicsDevice;
                    firstTime = false;
                }

                simpleColorEffect.Techniques[0].Passes[0].Apply();
                batch.Begin(
                            SpriteSortMode.Deferred,
                            BlendState.AlphaBlend, //BlendState.NonPremultiplied,
                            null, //SamplerState.AnisotropicClamp,
                            null, //DepthStencilState.None,
                            null, //RasterizerState.CullNone,
                            simpleColorEffect,
                            Stage.SpriteBatchMatrix);
                _debugDraw.FinishDrawShapes();
                batch.End();
            }
        }