Exemple #1
0
        protected override void Draw(GameTime gameTime)
        {
            _elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (DrawingManager.IgnoreClearBeforeRendering == false)
            {
                this.GraphicsDevice.Clear(this.DefaultClearColor);
            }
            if (SceneManager.ActiveScene != null)
            {
                if (SceneManager.Scenes.Count > 1)
                {
                    for (int i = 0; i < SceneManager.Scenes.Count; i++)
                    {
                        IceScene item = SceneManager.Scenes[i];

                        if (item != SceneManager.ActiveScene && item.WillRenderNotActive)
                        {
                            IceCore.DrawIceCreamScene(graphics.GraphicsDevice, _elapsed, item);
                        }
                    }
                }
                if (SceneManager.ActiveScene._hasBeenUpdatedOnce == true)
                {
                    IceCore.DrawIceCreamScene(graphics.GraphicsDevice, _elapsed, SceneManager.ActiveScene);
                }
                IceCore.RenderIceCream();
            }
            //for (int y = 0; y < SceneManager.ActiveScene._spatialGrid.Rows; y++)
            //{
            //    for (int x = 0; x < SceneManager.ActiveScene._spatialGrid.Cols; x++)
            //    {
            //        Drawing.DebugShapes.DrawLine(
            //            new Vector2(x * SceneManager.ActiveScene._spatialGrid.CellSize,
            //                        0),
            //            new Vector2(x * SceneManager.ActiveScene._spatialGrid.CellSize,
            //                        SceneManager.ActiveScene._spatialGrid.SceneHeight),
            //            Color.White);

            //    }
            //    Drawing.DebugShapes.DrawLine(
            //            new Vector2(0,
            //                y * SceneManager.ActiveScene._spatialGrid.CellSize),
            //            new Vector2(SceneManager.ActiveScene._spatialGrid.SceneWidth,
            //                y * SceneManager.ActiveScene._spatialGrid.CellSize),
            //            Color.White);
            //}

            base.Draw(gameTime);
        }
Exemple #2
0
        protected override void Draw(GameTime gameTime)
        {
            _elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (DrawingManager.IgnoreClearBeforeRendering == false)
            {
                this.GraphicsDevice.Clear(this.DefaultClearColor);
            }
            if (SceneManager.ActiveScene != null)
            {
                if (SceneManager.Scenes.Count > 1)
                {
                    for (int i = 0; i < SceneManager.Scenes.Count; i++)
                    {
                        IceScene item = SceneManager.Scenes[i];

                        if (item != SceneManager.ActiveScene && item.WillRenderNotActive)
                        {
                            IceCore.DrawIceCreamScene(graphics.GraphicsDevice, _elapsed, item);
                        }
                    }
                }
                if (SceneManager.ActiveScene._hasBeenUpdatedOnce == true)
                {
                    IceCore.DrawIceCreamScene(graphics.GraphicsDevice, _elapsed, SceneManager.ActiveScene);
                }

                IceCore.RenderIceCream();

                IceCream.Debug.OnScreenStats.Draw();

                DrawingManager.GraphicsDevice.RasterizerState   = RasterizerState.CullNone;
                DrawingManager.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

                //DrawingManager.SpriteBatch.Begin();
                IceFarseerManager.Instance.DrawDebug(DrawingManager.SpriteBatch, SceneManager.ActiveScene.ActiveCameras[0]);
                //DrawingManager.SpriteBatch.End();

                //PrimitiveBatch _primitiveBatch = new PrimitiveBatch(DrawingManager.GraphicsDevice);
                //_primitiveBatch.SetViewPortSize(DrawingManager.ViewPortSize.X, DrawingManager.ViewPortSize.Y);
                //_primitiveBatch.Begin(PrimitiveType.TriangleList, SceneManager.ActiveScene.ActiveCameras[0].GetMatrix(DebugShapes.Parallax));
                //Color colorFill = Color.Black;

                //List<Vector2> vertices = new List<Vector2>();
                //vertices.Add(new Vector2(0, 0));
                //vertices.Add(new Vector2(300, 0));
                //vertices.Add(new Vector2(100, 200));
                //vertices.Add(new Vector2(10, 20));

                //DebugShapes.DrawPolygon(vertices.ToArray(), colorFill);

                ////_primitiveBatch.AddVertex(vertices[0], colorFill);
                ////_primitiveBatch.AddVertex(vertices[1], colorFill);
                ////_primitiveBatch.AddVertex(vertices[2], colorFill);

                //Vector2[] _tempVertices = new Vector2[Settings.MaxPolygonVertices];
                //SceneItem testItem = SceneManager.ActiveScene.SceneItems[4];
                //foreach (Fixture fixture in testItem.IceFarseerEntity.Body.FixtureList)
                //{
                //    PolygonShape poly = (PolygonShape)fixture.Shape;
                //    int vertexCount = poly.Vertices.Count;
                //    System.Diagnostics.Debug.Assert(vertexCount <= Settings.MaxPolygonVertices);

                //    Transform xf;
                //    fixture.Body.GetTransform(out xf);
                //    for (int i = 0; i < vertexCount; ++i) {
                //        _tempVertices[i] = MathUtils.Multiply(ref xf, poly.Vertices[i]);
                //    }

                //    DebugShapes.DrawSolidPolygon(_tempVertices, vertexCount, colorFill);
                //}
                ////foreach (DebugLine line in DebugShapes.LinesList) {
                ////    _primitiveBatch.AddVertex(line.vertex, line.color);
                ////}
                //_primitiveBatch.End();
            }
            //for (int y = 0; y < SceneManager.ActiveScene._spatialGrid.Rows; y++)
            //{
            //    for (int x = 0; x < SceneManager.ActiveScene._spatialGrid.Cols; x++)
            //    {
            //        Drawing.DebugShapes.DrawLine(
            //            new Vector2(x * SceneManager.ActiveScene._spatialGrid.CellSize,
            //                        0),
            //            new Vector2(x * SceneManager.ActiveScene._spatialGrid.CellSize,
            //                        SceneManager.ActiveScene._spatialGrid.SceneHeight),
            //            Color.White);

            //    }
            //    Drawing.DebugShapes.DrawLine(
            //            new Vector2(0,
            //                y * SceneManager.ActiveScene._spatialGrid.CellSize),
            //            new Vector2(SceneManager.ActiveScene._spatialGrid.SceneWidth,
            //                y * SceneManager.ActiveScene._spatialGrid.CellSize),
            //            Color.White);
            //}

            base.Draw(gameTime);
        }