Пример #1
0
        public static void Draw(DrawerLine Line, DrawerOptions Options)
        {
            DrawerContent Content = new DrawerContent();

            Content.AppendLine(Line);
            Draw(Content, Options);
        }
Пример #2
0
        public static void Draw(String Text, ConsoleColor Color, Int32 Left, Int32 Top)
        {
            DrawerContent Content = new DrawerContent();
            DrawerOptions Options = new DrawerOptions()
            {
                Left = Left, Top = Top
            };
            DrawerLine Line = new DrawerLine(Text, Color);

            Content.AppendLine(Line);
            Draw(Content, Options);
        }
Пример #3
0
        private static SmallRect Matrix(DrawerContent Content, DrawerOptions Options)
        {
            SmallRect Rect = new SmallRect()
            {
                Left = (Int16)Options.Left, Top = (Int16)Options.Top
            };
            Int16 x = (Int16)Options.Left, y = (Int16)Options.Top;

            foreach (var l in Content.Lines)
            {
                if (l.Chars.Count + (Int16)Options.Left > x)
                {
                    x = (Int16)(l.Chars.Count + Options.Left);
                }
                y++;
            }
            Rect.Right  = x;
            Rect.Bottom = y;
            return(Rect);
        }
Пример #4
0
        public static void Draw(DrawerContent Content, DrawerOptions Options)
        {
            SafeFileHandle h = CreateFile("CONOUT$", 0x40000000, 2, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero);

            if (!h.IsInvalid)
            {
                SmallRect rect = Matrix(Content, Options);

                CharInfo[] buf = new CharInfo[(rect.Right - rect.Left) * (rect.Bottom - rect.Top)];

                Int32 Position = 0;

                for (int i = 0; i < (rect.Bottom - rect.Top); i++)
                {
                    Int32 Added = 0;
                    foreach (var symbol in Content.Lines[i].Chars)
                    {
                        buf[Position].Char       = symbol.Icon;
                        buf[Position].Attributes = ConvertToAttribute(symbol.Color, symbol.Back);
                        Position++;
                        Added++;
                    }
                    Position += (rect.Right - rect.Left) - Added;
                }

                bool b = WriteConsoleOutput(h, buf,
                                            new Coord()
                {
                    X = (Int16)(rect.Right - rect.Left), Y = (Int16)(rect.Bottom - rect.Top)
                },
                                            new Coord()
                {
                    X = 0, Y = 0
                },
                                            ref rect);
            }
        }
Пример #5
0
 public static void Draw(DrawerContent Content)
 {
     Draw(Content, new DrawerOptions());
 }