Пример #1
0
 /// <summary>
 /// Sets attributes for a specific unit in the buffer.
 /// </summary>
 /// <param name="x">The X coordinate of the unit.</param>
 /// <param name="y">The Y coordinate of the unit.</param>
 /// <param name="attributes">The attributes to assign to the unit.</param>
 public void SetUnitAttributes(int x, int y, BufferUnitAttributes attributes)
 {
     if (InBounds(ref x, ref y))
     {
         _buffer[y, x]._attrs = (short)attributes;
     }
 }
Пример #2
0
 /// <summary>
 /// Sets the attributes for a specific unit in the buffer.
 /// </summary>
 /// <param name="point">The location of the unit.</param>
 /// <param name="attributes">The attributes to assign to the unit.</param>
 public void SetUnitAttributes(Point point, BufferUnitAttributes attributes)
 {
     if (!InBounds(ref point))
     {
         return;
     }
     SetUnitAttributes(point.X, point.Y, attributes);
 }
Пример #3
0
        static void Painter_Paint(object sender, EventArgs e)
        {
            tickBuffer.Clear();
            var ab = Painter.ActiveBuffer;
            var b  = ab.Buffer;
            var b2 = tickBuffer.Buffer;
            int w  = ab.Width;
            int h  = ab.Height;
            int n  = 0;
            BufferUnitAttributes c = black;

            for (int i = 0; i < w; i++)
            {
                for (int j = 0; j < h; j++)
                {
                    n = CountNeighbors(ab, i, j);
                    c = b[j, i].Attributes;
                    if (n < 2 && c != black)
                    {
                        b2[j, i].Attributes = black;
                    }
                    else if (n <= 3 && c != black)
                    {
                        b2[j, i].Attributes = c & ~BufferUnitAttributes.BackgroundIntensity;
                    }
                    else if (n > 3 && c != black)
                    {
                        b2[j, i].Attributes = black;
                    }
                    else if (n == 3 && c == black)
                    {
                        b2[j, i].Attributes = PickColor();
                    }
                }
            }
            Array.Copy(b2, b, b.Length);
        }
Пример #4
0
 /// <summary>
 /// Sets the attributes for a specific unit in the buffer.
 /// </summary>
 /// <param name="point">The location of the unit.</param>
 /// <param name="attributes">The attributes to assign to the unit.</param>
 public void SetUnitAttributes(Point point, BufferUnitAttributes attributes)
 {
     if (!InBounds(ref point)) return;
     SetUnitAttributes(point.X, point.Y, attributes);
 }
Пример #5
0
 /// <summary>
 /// Sets attributes for a specific unit in the buffer.
 /// </summary>
 /// <param name="x">The X coordinate of the unit.</param>
 /// <param name="y">The Y coordinate of the unit.</param>
 /// <param name="attributes">The attributes to assign to the unit.</param>
 public void SetUnitAttributes(int x, int y, BufferUnitAttributes attributes)
 {
     if (InBounds(ref x, ref y))
     {
         _buffer[y, x]._attrs = (short)attributes;
     }
 }