public static DrawHandleRect CreateRectangle(GraphicsDevice g, Color c, int w, int h, bool outline = false, int outlinewidth = 1) { DrawHandleRect rect = new DrawHandleRect(g, w, h); if (!outline) { for (int i = 0; i < rect.Data.Length; i++) { rect.Data[i] = c; } rect.RectTexture.SetData(rect.Data); } else { Color trans = new Color(0, 0, 0, 0); int rowpos = 0; for (int i = 0; i < rect.Data.Length; i++) { if (i < outlinewidth * w || i > rect.Data.Length - outlinewidth * w || rowpos < outlinewidth || rowpos >= w - outlinewidth) { rect.Data[i] = c; } else { rect.Data[i] = trans; } rowpos++; if (rowpos >= w) { rowpos = 0; } } rect.RectTexture.SetData(rect.Data); } return(rect); }
public static void DrawRectangleHandle(DrawHandleRect rect, SpriteBatch s, int x, int y, int w, int h, Color color) { s.Draw(rect.RectTexture, new Rectangle(new Point(x, y), new Point(w, h)), color); }
public static void DrawRectangleHandle(DrawHandleRect rect, SpriteBatch s, float x, float y, Color color) { s.Draw(rect.RectTexture, new Vector2(x, y), color); }