public void Draw(SpriteBatch sb, Camera camera, MouseState state) { Vector2 topLeft = camera.GlobalToCameraPos(Bounds.Left, Bounds.Top); Vector2 dimensions = camera.GlobalToCameraPos(Bounds.Right, Bounds.Bottom); Rectangle r = new Rectangle((int)topLeft.X, (int)topLeft.Y, (int)dimensions.X - (int)topLeft.X, (int)dimensions.Y - (int)topLeft.Y); Editor.DrawRectangleOutline(sb, r, Color.GreenYellow); Editor.DrawRectangleOutline(sb, new Rectangle(r.Left - 2, r.Top - 2, 4, 4), Color.GreenYellow); Editor.DrawRectangleOutline(sb, new Rectangle(r.Right - 2, r.Top - 2, 4, 4), Color.GreenYellow); Editor.DrawRectangleOutline(sb, new Rectangle(r.Left - 2, r.Bottom - 2, 4, 4), Color.GreenYellow); Editor.DrawRectangleOutline(sb, new Rectangle(r.Right - 2, r.Bottom - 2, 4, 4), Color.GreenYellow); if (Bounds.Contains((int)camera.CameraToGlobalPos(state.X, state.Y).X, (int)camera.CameraToGlobalPos(state.X, state.Y).Y)) sb.DrawString(Editor.Font, Name, topLeft + Vector2.One, Color.Black); }
public void Draw(SpriteBatch sb, Camera camera) { if (points.Count > 1) { for (int i = 0; i < points.Count - 1; i++) { Editor.DrawRectangleOutline(sb, new Rectangle((int)camera.GlobalToCameraPos(points[i]).X - 2, (int)camera.GlobalToCameraPos(points[i]).Y - 2, 4, 4), Color.Red); Editor.DrawLine(sb, camera.GlobalToCameraPos(points[i]), camera.GlobalToCameraPos(points[i + 1]), Color.Red); } Editor.DrawRectangleOutline(sb, new Rectangle((int)camera.GlobalToCameraPos(points[points.Count - 1]).X - 2, (int)camera.GlobalToCameraPos(points[points.Count - 1]).Y - 2, 4, 4), Color.Red); Editor.DrawLine(sb, camera.GlobalToCameraPos(points[points.Count - 1]), camera.GlobalToCameraPos(points[0]), Color.Red); } }
public void Draw(SpriteBatch sb, Camera camera, Color c) { sb.Draw(Editor.ObjectTextures[this.Texture], camera.GlobalToCameraPos((int)Position.X, (int)Position.Y), null, c, ParameterNames != null && ParameterNames.Contains("Rotation") ? float.Parse(ValueFromName("Rotation")) : 0f, new Vector2(Editor.ObjectTextures[this.Texture].Width / 2, Editor.ObjectTextures[this.Texture].Height / 2), camera.TotalScale * ((ParameterNames != null && ParameterNames.Contains("Width") ? float.Parse(ValueFromName("Width")) / Editor.ObjectTextures[this.Texture].Width : 1f) * Vector2.UnitX + (ParameterNames != null && ParameterNames.Contains("Height") ? float.Parse(ValueFromName("Height")) / Editor.ObjectTextures[this.Texture].Height : 1f) * Vector2.UnitY), SpriteEffects.None, 0.5555556f); }
public void Draw(SpriteBatch sb, Camera camera) { Vector2 topLeft = camera.GlobalToCameraPos(Bounds.Left, Bounds.Top); Vector2 dimensions = camera.GlobalToCameraPos(Bounds.Right, Bounds.Bottom); Rectangle r = new Rectangle((int)topLeft.X, (int)topLeft.Y, (int)dimensions.X - (int)topLeft.X, (int)dimensions.Y - (int)topLeft.Y); Editor.DrawRectangleOutline(sb, r, Color.Blue); Editor.DrawRectangleOutline(sb, new Rectangle(r.Left - 2, r.Top - 2, 4, 4), Color.Blue); Editor.DrawRectangleOutline(sb, new Rectangle(r.Right - 2, r.Top - 2, 4, 4), Color.Blue); Editor.DrawRectangleOutline(sb, new Rectangle(r.Left - 2, r.Bottom - 2, 4, 4), Color.Blue); Editor.DrawRectangleOutline(sb, new Rectangle(r.Right - 2, r.Bottom - 2, 4, 4), Color.Blue); Editor.DrawLine(sb, camera.GlobalToCameraPos(Target - Vector2.One * 2), camera.GlobalToCameraPos(Target + Vector2.One * 2), Color.Blue); Editor.DrawLine(sb, camera.GlobalToCameraPos(Target + Vector2.UnitX * 2 - Vector2.UnitY * 2), camera.GlobalToCameraPos(Target - Vector2.UnitX * 2 + Vector2.UnitY * 2), Color.Blue); }