public void Draw() { DrawHelper.DrawShape(boundry, Color.white); if (subdivided) { tl.Draw(); tr.Draw(); bl.Draw(); br.Draw(); } }
/// <summary> /// the function where everything is drawn after (above) the player /// </summary> internal void Post_draw(SpriteBatch batch) { grid.Post_draw(batch); foreach (SpriteObject st in GetDrawTiles(false)) { st.Draw(batch); } #if DEBUG quadTree.Draw(batch); #endif }
public static void QuadtreeNonAllocTest() { float topBoundry = float.MinValue; float bottomBoundry = float.MaxValue; float leftBoundry = float.MaxValue; float rightBoundry = float.MinValue; foreach (var s in ShapeSystem.shapes) { if (s.center.x > rightBoundry) { rightBoundry = s.center.x; } if (s.center.x < leftBoundry) { leftBoundry = s.center.x; } if (s.center.y > topBoundry) { topBoundry = s.center.y; } if (s.center.y < bottomBoundry) { bottomBoundry = s.center.y; } } q.Resize( (rightBoundry + leftBoundry) / 2, (topBoundry + bottomBoundry) / 2, rightBoundry - leftBoundry, topBoundry - bottomBoundry); q.Clear(); foreach (var s in ShapeSystem.shapes) { q.Insert(s); } q.ClearEmptySubdivisions(); if (Settings.debugDrawTree) { q.Draw(); } foreach (var s in ShapeSystem.shapes) { q.Search(s); } }
public static void QuadtreeTest() { float topBoundry = float.MinValue; float bottomBoundry = float.MaxValue; float leftBoundry = float.MaxValue; float rightBoundry = float.MinValue; foreach (var s in ShapeSystem.shapes) { if (s.center.x > rightBoundry) { rightBoundry = s.center.x; } if (s.center.x < leftBoundry) { leftBoundry = s.center.x; } if (s.center.y > topBoundry) { topBoundry = s.center.y; } if (s.center.y < bottomBoundry) { bottomBoundry = s.center.y; } } q = new Quadtree( new Rectangle(new Vector2((rightBoundry + leftBoundry) / 2, (topBoundry + bottomBoundry) / 2), rightBoundry - leftBoundry, topBoundry - bottomBoundry), 4); foreach (var s in ShapeSystem.shapes) { q.Insert(s); } if (Settings.debugDrawTree) { q.Draw(); } foreach (var s in ShapeSystem.shapes) { q.Search(s); } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { Action <Vector2, Vector2, Color> drawLine = (p1, p2, color) => { DrawLine(spriteBatch, p1, p2, color, 1); }; Action <string, Vector2> drawString = (text, pos) => { }; GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); world.Draw(drawLine, drawString); poly1.Draw(drawLine, drawString); spriteBatch.End(); base.Draw(gameTime); }