public static string F(this ColorfulString source, params object[] args) { return(string.Format(source, args)); }
public override void Init() { base.Init(); buffer = ConsoleRenderer.ActiveBuffer; textBox = new TextBox(controlManager) { Width = 34, Height = 13, Text = "Hello there", Attributes = CharAttribute.ForegroundWhite | CharAttribute.BackgroundDarkRed, WordBreak = WordBreak.Hard, TextAlign = TextAlign.Left }; textBox.Text = lorem; textBox.MousePressed += TextBox_MousePressed; textBox.Visible = false; //textBox.MouseReleased += TextBox_MouseReleased; dataBox = new TextBox(controlManager) { Width = 20, Height = 2, Name = "hello", Text = textBox.Rectangle.Size.ToString(), Attributes = CharAttribute.ForegroundGreen }; dataBox.Width = dataBox.Text.Length; dataBox.Visible = false; vs = new VerticalScrollbar(controlManager) { Height = 5, Left = 20, Top = 4 }; hs = new HorizontalScrollbar(controlManager) { Width = 10, Left = 3, Top = Height - 1 }; new ScrollableTextBox(controlManager) { Width = 20, Height = 5 }; colorfulString = new ColorfulString { Value = new string(Enumerable.Repeat('A', Enum.GetValues(typeof(CharAttribute)).Length - 0).ToArray()), ColorThing = ColorSelectMode.Repeat, Attributes = (CharAttribute[])Enum.GetValues(typeof(CharAttribute)) }; strings = new string[] { "Haha", "Console", "Go", "Brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr" }.NormalizeLengths() .PadAround(2); int ratioX = 2; int ratioY = 1; int scale = 2; int spacingX = ratioX * scale; int spacingY = ratioY * scale; int pieceWidth = 2; int pieceHeight = 1; int tileWidth = pieceWidth + spacingX * 2; int tileHeight = pieceHeight + spacingY * 2; square = new CharInfo[8 * tileHeight, 8 * tileWidth]; for (int y = 0; y < square.GetLength(0); y++) { for (int x = 0; x < square.GetLength(1); x++) { square[y, x].Attributes |= ((x / tileWidth + y / tileHeight) % 2 == 0 ? CharAttribute.BackgroundGrey | CharAttribute.ForegroundBlack : CharAttribute.BackgroundBlack | CharAttribute.ForegroundWhite); } } for (int y = 0; y < square.GetLength(0); y++) { for (int x = 0; x < square.GetLength(1); x++) { if (x % tileWidth == 0 && y % tileHeight == 0) { int px = x + spacingX; int py = y + spacingY; square[py, px].UnicodeChar = '♕'; square[py, px].Attributes |= CharAttribute.LeadingByte; var yellow = CharAttribute.BackgroundYellow | CharAttribute.ForegroundBlack; var marker = new CharInfo { UnicodeChar = ShadingCharacter.Light, Attributes = yellow }; } } } backface = new BufferArea(square.GetLength(1) + 4, square.GetLength(0) + 2); CharInfo backChar = new CharInfo { UnicodeChar = ShadingCharacter.Dark, Attributes = CharAttribute.BackgroundDarkGrey }; backface.Fill(backChar); //Draw(); ConsoleInput.KeyPressed += ConsoleInput_KeyPressed; ConsoleInput.KeyHeld += ConsoleInput_KeyPressed; ConsoleInput.MouseReleased += TextBox_MouseReleased; ConsoleInput.MouseDragged += ConsoleInput_MouseDragged; ConsoleInput.Resized += ConsoleInput_Resized; //ConsoleInput.Resized += delegate //{ // Draw(); //}; Draw(); }