Exemplo n.º 1
0
 public void Draw(ConsoleEngine engine)
 {
     for (int y = 0; y < Height; y++)
     {
         for (int x = 0; x < Width; x++)
         {
             engine.SetPixel(new Point(x, y), 15, ConsoleCharacter.Full);
         }
     }
 }
Exemplo n.º 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;
            }
        }