/// <summary> /// This method draws any text to the buffer with given color. /// To change the color, pass in a value above 0. (0 being black text, 15 being white text). /// Put in the starting width and height you want the input string to be. /// </summary> /// <param name="str"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="attribute"></param> public void Draw(String str, int x, int y, ConsoleCharAttribute attribute) //Draws the image to the buffer { if (x > windowWidth - 1 || y > windowHeight - 1) { throw new System.ArgumentOutOfRangeException(); } if (str != null) { Char[] temp = str.ToCharArray(); int tc = 0; foreach (Char le in temp) { buf[(x + tc) + (y * width)].Char.AsciiChar = (byte)(int)le; //Height * width is to get to the correct spot (since this array is not two dimensions). if (attribute.Attribute != 0) { buf[(x + tc) + (y * width)].Attributes = attribute; } tc++; } } }
/// <summary> /// Creates a new instance of the ConsoleCharInfo structure. /// </summary> /// <param name="aChar">The ASCII character.</param> /// <param name="attr">Character attributes.</param> public ConsoleCharInfo(byte aChar, ConsoleCharAttribute attr) { cUnicodeChar = '\x0'; bAsciiChar = aChar; this.attr = attr; }
/// <summary> /// Creates a new instance of the ConsoleCharInfo structure. /// </summary> /// <param name="uChar">The Unicode character.</param> /// <param name="attr">Character attributes.</param> public ConsoleCharInfo(char uChar, ConsoleCharAttribute attr) { bAsciiChar = 0; cUnicodeChar = uChar; this.attr = attr; }