Esempio n. 1
0
        static unsafe void Demo6(RGBLedMatrix matrix)
        {
            play = true;

            try
            {
                matrix.Fill(0, 0, 0);

                Bitmap [] bitmaps = new Bitmap []
                {
                    new Bitmap(@"bitmaps/dotnet-bot-branded-32x32.bmp"),
                    new Bitmap(@"bitmaps/i-love-dotnet.bmp")
                };

                int x           = matrix.Width - 1;
                int bitmapIndex = 0;
                while (play)
                {
                    matrix.DrawBitmap(x, 0, bitmaps[bitmapIndex]);

                    if (x + bitmaps[bitmapIndex].Width < matrix.Width)
                    {
                        matrix.FillRectangle(x + bitmaps[bitmapIndex].Width, 0, matrix.Width - x - bitmaps[bitmapIndex].Width, matrix.Height, 0, 0, 0);
                    }

                    x--;

                    if (x == -bitmaps[bitmapIndex].Width)
                    {
                        bitmapIndex = (bitmapIndex + 1) % bitmaps.Length;
                        x           = matrix.Width - 1;
                    }

                    Thread.Sleep(25);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 2
0
        static void Demo2(RGBLedMatrix matrix)
        {
            int length = matrix.Width / 4;
            int height = matrix.Height / 4;

            play = true;
            while (play)
            {
                matrix.FillRectangle(0, 0, length, length, 255, 0, 0);
                matrix.FillRectangle(length, 0, length, length, 0, 255, 0);
                matrix.FillRectangle(2 * length, 0, length, length, 0, 0, 255);
                matrix.FillRectangle(3 * length, 0, length, length, 255, 255, 0);

                matrix.FillRectangle(0, height, length, length, 255, 0, 255);
                matrix.FillRectangle(length, height, length, length, 255, 255, 255);
                matrix.FillRectangle(2 * length, height, length, length, 0, 130, 0);
                matrix.FillRectangle(3 * length, height, length, length, 130, 0, 0);

                matrix.FillRectangle(0, 2 * height, length, length, 0, 0, 128);
                matrix.FillRectangle(length, 2 * height, length, length, 192, 192, 192);
                matrix.FillRectangle(2 * length, 2 * height, length, length, 128, 128, 0);
                matrix.FillRectangle(3 * length, 2 * height, length, length, 128, 128, 128);

                matrix.FillRectangle(0, 3 * height, length, length, 40, 40, 40);
                matrix.FillRectangle(length, 3 * height, length, length, 80, 80, 80);
                matrix.FillRectangle(2 * length, 3 * height, length, length, 120, 120, 120);
                matrix.FillRectangle(3 * length, 3 * height, length, length, 0, 120, 120);

                Thread.Sleep(5000);
            }
        }