Exemplo n.º 1
0
 //Scroll left one letter
 public void ScrollLeftAround(int chars)
 {
     XConsole.CHAR_INFO temp = Buffer[0];
     for (int n = 0; n < length - chars - 1; n++)
     {
         Buffer[n] = Buffer[n + chars];
     }
     Buffer[length - 1] = temp;
 }
Exemplo n.º 2
0
 //clears the buffer
 public void Clear(Style style, byte letter = 32)
 {
     for (int n = 0; n < length; n++)
     {
         Buffer[n] = new XConsole.CHAR_INFO(letter, 0, style.color);
     }
     if (style.frame)
     {
         for (int n = 0; n < size.x; n++)
         {
             Buffer[n].Attributes += XConsole.ATTR_FRAME_TOP;
             Buffer[length - n - 1].Attributes += XConsole.ATTR_FRAME_BOTTOM;
         }
         for (int n = 0; n < size.y; n++)
         {
             Buffer[n * size.x].Attributes           += XConsole.ATTR_FRAME_LEFT;
             Buffer[(n + 1) * size.x - 1].Attributes += XConsole.ATTR_FRAME_RIGHT;
         }
     }
     MoveTo();//reset virtual cursor
 }
Exemplo n.º 3
0
        //writes a styled text
        public void Write(byte[] chars, Style style)
        {
            if (cursor_y >= size.y)
            {
                return;
            }
            int offset    = cursor_y * size.x + cursor_x;
            int maxlength = length - offset;
            int strlength = chars.Length;

            if (maxlength < strlength)
            {
                strlength = maxlength;
            }
            byte[] attr = new byte[strlength--];
            if (style.frame)
            {
                attr[0] = XConsole.ATTR_FRAME_TOP + XConsole.ATTR_FRAME_LEFT + XConsole.ATTR_FRAME_BOTTOM;
                for (int n = 1; n < strlength; n++)
                {
                    attr[n] = XConsole.ATTR_FRAME_TOP + XConsole.ATTR_FRAME_BOTTOM;
                }
                attr[strlength] = XConsole.ATTR_FRAME_TOP + XConsole.ATTR_FRAME_RIGHT + XConsole.ATTR_FRAME_BOTTOM;
            }
            else
            {
                for (int n = 0; n <= strlength; n++)
                {
                    attr[n] = 0;
                }
            }
            for (int n = 0; n <= strlength; n++)
            {
                Buffer[offset + n] = new XConsole.CHAR_INFO(chars[n], attr[n], style.color);
            }
            cursor_x += strlength + 1;
            cursor_y += cursor_x / size.x;
            cursor_x %= size.x;
        }