コード例 #1
0
ファイル: Demo.cs プロジェクト: jbukys/Nusbio.Samples
        private static void DrawRoundRectDemo(NusbioMatrix matrix, int wait, int maxRepeat, int deviceIndex)
        {
            Console.Clear();
            ConsoleEx.TitleBar(0, "Draw Round Rectangle Demo");

            matrix.CurrentDeviceIndex = deviceIndex;

            for (byte rpt = 0; rpt <= maxRepeat; rpt += 2)
            {
                matrix.Clear(deviceIndex);
                var yy = 0;
                while (yy <= 3)
                {
                    matrix.DrawRoundRect(yy, yy, 8 - (yy * 2), 8 - (yy * 2), 2, 1);
                    matrix.CopyToAll(deviceIndex, true);
                    TimePeriod.Sleep(wait);
                    yy += 1;
                }
                TimePeriod.Sleep(wait);
                yy = 2;
                while (yy >= 0)
                {
                    matrix.DrawRoundRect(yy, yy, 8 - (yy * 2), 8 - (yy * 2), 2, 0);
                    matrix.CopyToAll(deviceIndex, true);
                    TimePeriod.Sleep(wait);
                    yy -= 1;
                }
                matrix.Clear(deviceIndex);
                matrix.CopyToAll(deviceIndex, true);
                TimePeriod.Sleep(wait);
            }
        }
コード例 #2
0
ファイル: Demo.cs プロジェクト: jbukys/Nusbio.Samples
        private static void DrawRectDemo(NusbioMatrix matrix, int MAX_REPEAT, int wait, int deviceIndex)
        {
            Console.Clear();
            ConsoleEx.TitleBar(0, "Draw Rectangle Demo");
            ConsoleEx.WriteMenu(0, 2, "Q)uit");

            matrix.Clear(deviceIndex);
            matrix.CopyToAll(deviceIndex, refreshAll: true);
            matrix.CurrentDeviceIndex = deviceIndex;

            for (byte rpt = 0; rpt < MAX_REPEAT; rpt += 3)
            {
                matrix.Clear();
                var y = 0;
                while (y <= 4)
                {
                    matrix.DrawRect(y, y, 8 - (y * 2), 8 - (y * 2), true);
                    matrix.CopyToAll(deviceIndex, refreshAll: true);
                    TimePeriod.Sleep(wait);
                    y += 1;
                }
                TimePeriod.Sleep(wait);
                y = 4;
                while (y >= 1)
                {
                    matrix.DrawRect(y, y, 8 - (y * 2), 8 - (y * 2), false);
                    matrix.CopyToAll(deviceIndex, refreshAll: true);
                    TimePeriod.Sleep(wait);
                    y -= 1;
                }
            }
            matrix.Clear(deviceIndex);
        }
コード例 #3
0
ファイル: Demo.cs プロジェクト: jbukys/Nusbio.Samples
        static void DisplayImageSequence(NusbioMatrix matrix, string title, int deviceIndex, int maxRepeat, int wait, List <List <string> > images)
        {
            matrix.CurrentDeviceIndex = deviceIndex;
            Console.Clear();
            ConsoleEx.TitleBar(0, title);
            ConsoleEx.WriteMenu(0, 2, "Q)uit");

            for (byte rpt = 0; rpt < maxRepeat; rpt++)
            {
                foreach (var image in images)
                {
                    matrix.Clear(deviceIndex, refresh: false);
                    matrix.DrawBitmap(0, 0, image, 8, 8, 1);
                    matrix.CopyToAll(deviceIndex, refreshAll: true);
                    TimePeriod.Sleep(wait);

                    if (Console.KeyAvailable)
                    {
                        if (Console.ReadKey().Key == ConsoleKey.Q)
                        {
                            return;
                        }
                    }
                }
            }
            matrix.Clear(deviceIndex, refresh: true);
        }
コード例 #4
0
ファイル: Demo.cs プロジェクト: jbukys/Nusbio.Samples
        private static void DrawCircleDemo(NusbioMatrix matrix, int wait, int deviceIndex)
        {
            Console.Clear();
            ConsoleEx.TitleBar(0, "DrawCircle Demo");

            matrix.CurrentDeviceIndex = deviceIndex;
            matrix.Clear(deviceIndex);
            matrix.CopyToAll(deviceIndex, refreshAll: true);

            var circleLocations = new List <Coordinate>()
            {
                new Coordinate {
                    X = 4, Y = 4
                },
                new Coordinate {
                    X = 3, Y = 3
                },
                new Coordinate {
                    X = 5, Y = 5
                },
                new Coordinate {
                    X = 2, Y = 2
                },
            };

            foreach (var circleLocation in circleLocations)
            {
                for (byte ray = 0; ray <= 4; ray++)
                {
                    matrix.Clear(deviceIndex);
                    matrix.DrawCircle(circleLocation.X, circleLocation.Y, ray, 1);
                    matrix.CopyToAll(deviceIndex, refreshAll: true);
                    TimePeriod.Sleep(wait);
                }
            }
        }