Exemple #1
0
 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);
 }