private void DrawTitleLeft(ContainerBuffer buffer)
        {
            var counter = 0;

            for (var i = 3; i < Math.Min(Size.Width, Title.Length) - 3; i++)
            {
                buffer[i, 1] = new ConsoleElement(Title[counter], ForegroundColor, BackgroundColor);
                counter++;
            }
        }
        private void DrawTitleRight(ContainerBuffer buffer)
        {
            var counter = 0;

            for (var i = Size.Width - 3; i > Math.Max(3, Size.Width - 3 - Title.Length); i++)
            {
                buffer[i, 1] = new ConsoleElement(Title[counter], ForegroundColor, BackgroundColor);
                counter++;
            }
        }
Beispiel #3
0
        internal override ComponentBuffer CreateBuffer()
        {
            var buffer = new ComponentBuffer(new Dimension(Text.Length, 1));
            for (var i = 0; i < Text.Length; i++)
            {
                buffer[i, 0] = new ConsoleElement(Text[i], ForegroundColor, BackgroundColor);
            }

            return buffer;
        }
        private void DrawTitleCenter(ContainerBuffer buffer)
        {
            var start = Math.Max(3, Size.Width / 2 - Title.Length / 2);
            var end   = Math.Min(Size.Width - 3, Title.Length);

            var counter = 0;

            for (var i = start; i < end; i++)
            {
                buffer[i, 1] = new ConsoleElement(Title[counter], ForegroundColor, BackgroundColor);
                counter++;
            }
        }
Beispiel #5
0
        public override void Write(string value)
        {
            foreach (var c in value)
            {
                if (CursorLeft >= BufferWidth - 1 && CursorTop >= BufferHeight - 1)
                {
                    return; //Out of view
                }
                Buffer[CursorLeft, CursorTop] = new ConsoleElement(c, ForegroundColor, BackgroundColor);

                CursorLeft++;
            }
        }
 private void DrawBorder(ContainerBuffer buffer)
 {
     for (var y = 0; y < Size.Height; y++)
     {
         for (var x = 0; x < Size.Width; x++)
         {
             if (y == 0)
             {
                 if (x == 0)
                 {
                     buffer[x, y] = new ConsoleElement(Border.TopLeftCorner, ForegroundColor, BackgroundColor);
                 }
                 else if (x == Size.Width - 1)
                 {
                     buffer[x, y] = new ConsoleElement(Border.TopRightCorner, ForegroundColor, BackgroundColor);
                 }
                 else
                 {
                     buffer[x, y] = new ConsoleElement(Border.HorizontalLine, ForegroundColor, BackgroundColor);
                 }
             }
             else if (y == Size.Height - 1)
             {
                 if (x == 0)
                 {
                     buffer[x, y] = new ConsoleElement(Border.BottomLeftCorner, ForegroundColor, BackgroundColor);
                 }
                 else if (x == Size.Width - 1)
                 {
                     buffer[x, y] = new ConsoleElement(Border.BottomRightCorner, ForegroundColor, BackgroundColor);
                 }
                 else
                 {
                     buffer[x, y] = new ConsoleElement(Border.HorizontalLine, ForegroundColor, BackgroundColor);
                 }
             }
             else
             {
                 if (x == 0 || x == Size.Width - 1)
                 {
                     buffer[x, y] = new ConsoleElement(Border.VerticalLine, ForegroundColor, BackgroundColor);
                 }
                 else
                 {
                     buffer[x, y] = new ConsoleElement(' ', ForegroundColor, BackgroundColor);
                 }
             }
         }
     }
 }
Beispiel #7
0
        internal CoreGui()
        {
            Console = new ConsoleElement(this);

            FPSLabel = new TextLabel
            {
                Parent           = this,
                BackgroundColour = Colour.Transparent,
                Position         = new UDim2(0, -4, 0, 4),
                Size             = new UDim2(1, 0, 1, 0),
                TextAlignmentX   = AlignmentX.Right,
                TextAlignmentY   = AlignmentY.Top
            };
        }