Esempio n. 1
0
File: Draw.cs Progetto: n0n4/RelaUI
        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);
        }
Esempio n. 2
0
File: Draw.cs Progetto: n0n4/RelaUI
 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);
 }
Esempio n. 3
0
File: Draw.cs Progetto: n0n4/RelaUI
 public static void DrawRectangleHandle(DrawHandleRect rect, SpriteBatch s, float x, float y, Color color)
 {
     s.Draw(rect.RectTexture, new Vector2(x, y), color);
 }