public static void Main(string[] args)
        {
            var consoleEngine = new ConsoleEngine(60, 45, 8, 8);

            while (true)
            {
                consoleEngine.WriteText(new Point(05, 0), "New", 3, 4);
                consoleEngine.Sector(new Point(05, 5), 4, 180, 270, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(15, 5), 4, 360, 0, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(25, 5), 4, 0, 360, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(35, 5), 4, 270, 90, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(45, 5), 4, -90, 135, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Sector(new Point(55, 5), 4, 90, 270, 4, 13, ConsoleCharacter.Full);

                consoleEngine.WriteText(new Point(05, 10), "Old", 3, 4);
                consoleEngine.SemiCircle(new Point(05, 15), 4, 180, 270, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(15, 15), 4, 360, 0, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(25, 15), 4, 0, 360, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(35, 15), 4, 270, 90, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(45, 15), 4, -90, 135, 4, 13, ConsoleCharacter.Full);
                consoleEngine.SemiCircle(new Point(55, 15), 4, 90, 270, 4, 13, ConsoleCharacter.Full);


                consoleEngine.WriteText(new Point(05, 20), "New", 3, 4);
                consoleEngine.Arc2(new Point(05, 25), 4, 180, 270, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Arc2(new Point(15, 25), 4, 360, 0, 4, 13, ConsoleCharacter.Full);
                consoleEngine.Arc2(new Point(25, 25), 4, 0, 360, 4, 13, ConsoleCharacter.Full);

                consoleEngine.WriteText(new Point(05, 30), "Old", 3, 4);
                consoleEngine.Arc(new Point(05, 35), 4, 4, 13, 270, ConsoleCharacter.Full);
                consoleEngine.Arc(new Point(15, 35), 4, 4, 13, 0, ConsoleCharacter.Full);
                consoleEngine.Arc(new Point(25, 35), 4, 4, 13, 360, ConsoleCharacter.Full);

                consoleEngine.Circle(new Point(45, 25), 4, 4, 13, ConsoleCharacter.Full);

                consoleEngine.DisplayBuffer();
            }
        }
Beispiel #2
0
        static void ProcessMessage()
        {
            if (buffer[last_buffer_point] == '[')
            {
                message_length = 0;
            }
            message[message_length] = buffer[last_buffer_point];
            message_length++;

            if (buffer[last_buffer_point] == ']')
            {
                if (message_length > 2)
                {
                    data_length = 0;
                    for (int j = 1; j < message_length - 1; j++)
                    {
                        switch (message[j])
                        {
                        case 0x5c:     // \
                            j++;
                            data[data_length] = message[j];
                            data_length++;
                            break;
                        }
                    }
                    if (data_length > 0)
                    {
                        //LogData();

                        //Engine.ClearBuffer();
                        if (data_length == 3)
                        {
                            if (data[0] == 0x78 && data[1] == 0x00 && data[2] == 0x7f)
                            {
                                Engine.DisplayBuffer();
                                pixel_x = 0;
                                pixel_y = 0;
                            }
                        }
                        else
                        {
                            if (data_length == 33)
                            {
                                for (int b = 2; b < 33; b++)
                                {
                                    byte c = data[b];
                                    for (int i = 7; i >= 0; i--)
                                    {
                                        if (((c >> i) & 1) == 1)
                                        {
                                            Engine.SetPixel(new Point(pixel_x, pixel_y + i), (int)ConsoleColor.White, (int)ConsoleColor.White);
                                        }
                                        else
                                        {
                                            Engine.SetPixel(new Point(pixel_x, pixel_y + i), (int)ConsoleColor.Black, (int)ConsoleColor.Black);
                                        }
                                    }
                                    pixel_x++;
                                    if (pixel_x >= 128)
                                    {
                                        pixel_x  = 0;
                                        pixel_y += 8;
                                    }
                                    if (pixel_y > 63)
                                    {
                                        pixel_y = 63;
                                    }
                                }
                            }
                        }

                        //Console.WriteLine(ByteArrayToString(data, data_length));
                    }
                }
                message_length = 0;
            }
        }