public void DrawFromMiniMap(Vector2 Position, float Size, Vector2 Min, Vector2 Max) { if (this.MinPos.X > Max.X || this.MinPos.Y > Max.Y || this.MaxPos.X < Min.X || this.MaxPos.Y < Min.Y) { return; } LinkedListNode <GameObject> Node = Nodes.Value.First; while (Node != null) { WallNode n = (WallNode)Node.Value; if (Node.Next != null) { WallNode n2 = (WallNode)Node.Next.Value; Vector2 MapPosition = (n.Position.get() - Min) / (Max - Min) * Size + Position; Vector2 MapPosition2 = (n2.Position.get() - Min) / (Max - Min) * Size + Position; Vector2 MPosition = Position + new Vector2(Size); MapPosition = Logic.Clamp(MapPosition, Position, MPosition); MapPosition2 = Logic.Clamp(MapPosition2, Position, MPosition); Render.DrawLine(MapPosition, MapPosition2, Color.Gray); } Node = Node.Next; } }
public void DrawGrid() { #if EDITOR && WINDOWS if (UseGrid.get() && GridSize.get().X > 0 && GridSize.get().Y > 0) { Vector2 StartPos = new Vector2( (float)Math.Floor(DrawCamera.getTopLeftCorner().X / GridSize.get().X) * GridSize.get().X , (float)Math.Floor(DrawCamera.getTopLeftCorner().Y / GridSize.get().Y) * GridSize.get().Y ); //StartPos.X = Math.Max(StartPos.X, MinBoundary.X()); //StartPos.Y = Math.Max(StartPos.Y, MinBoundary.Y()); Vector2 EndPos = DrawCamera.getBottomRightCorner(); //EndPos.X = Math.Min(EndPos.X, MaxBoundary.X()); //EndPos.Y = Math.Min(EndPos.Y, MaxBoundary.Y()); for (float x = StartPos.X; x < EndPos.X; x += GridSize.get().X) { if (x >= MinBoundary.X() && x <= MaxBoundary.X()) { Render.DrawLine(new Vector2(x, Math.Max(StartPos.Y, MinBoundary.Y())), new Vector2(x, Math.Min(EndPos.Y, MaxBoundary.Y())), GridColor * 0.5f, 1 / DrawCamera.getZoom()); } } for (float y = StartPos.Y; y < EndPos.Y; y += GridSize.get().Y) { if (y >= MinBoundary.Y() && y <= MaxBoundary.Y()) { Render.DrawLine(new Vector2(Math.Max(StartPos.X, MinBoundary.X()), y), new Vector2(Math.Min(EndPos.X, MaxBoundary.X()), y), GridColor * 0.5f, 1 / DrawCamera.getZoom()); } } } Render.DrawOutlineRect(MinBoundary.get(), MaxBoundary.get(), 1 / DrawCamera.getZoom(), Color.Red); #endif }
public void DrawThumbnail() { if (ThumbRectangle != null) { if (SceneThumbnail != null) { Game1.spriteBatch.Draw(SceneThumbnail, ThumbRectangle, Color.White); } Render.DrawSolidRect(ThumbRectangle, ParentLevel.MyScene == this ? Color.Red : ParentLevel.StartingScene == this ? Color.LightGreen : Color.White); Game1.spriteBatch.DrawString(FormFormat.NormalFont, Name.get(), ThumbNamePosition, ParentLevel.MyScene == this ? FormFormat.SelectedTextColor : FormFormat.TextColor); if (ParentLevel.StartingScene == this) { Render.DrawLine(new Vector2(ThumbRectangle.X + 16, ThumbRectangle.Y + 16), new Vector2(ThumbRectangle.X + 16, ThumbRectangle.Y + 48), Color.LightGreen); Render.DrawLine(new Vector2(ThumbRectangle.X + 16, ThumbRectangle.Y + 16), new Vector2(ThumbRectangle.X + 48, ThumbRectangle.Y + 32), Color.LightGreen); Render.DrawLine(new Vector2(ThumbRectangle.X + 16, ThumbRectangle.Y + 48), new Vector2(ThumbRectangle.X + 48, ThumbRectangle.Y + 32), Color.LightGreen); } SceneSelect.self.NeedsToRedraw = true; } }