Example #1
0
        public static void InitializeHerdRider(NwazetGoImaging.VirtualCanvas canvas)
        {
            canvas.SetOrientation(NwazetGoImaging.Orientation.Portrait);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(35, 10, (ushort)NwazetGoImaging.BasicColor.Black, NwazetGoFonts.DejaVuSansBold9.ID, "Herd Rider by Larouex");

            var fontInfo = new NwazetGoFonts.DejaVuSans9().GetFontInfo();

            var button = new NwazetGoDisplayTouchScreen.ButtonWidget(10, 30, 220, 50, fontInfo, "Configure WiFi");

            button.FillColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(255, 255, 255);
            button.FontColorClicked = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(0, 255, 0);
            button.FillColor        = NwazetGoImaging.ColorHelpers.GetRGB24toRGB565(0, 0, 255);
            canvas.RegisterWidget(button);
            canvas.RenderWidgets();

            while (!button.Clicked)
            {
                canvas.ActivateWidgets(true);
                canvas.RenderWidgets();
                canvas.Execute();

                canvas.TouchscreenWaitForEvent();

                canvas.RenderWidgets(NwazetGoImaging.Render.All);
                canvas.Execute();
            }
        }
Example #2
0
        public static void BasicUITest(
            NwazetGoImaging.VirtualCanvas canvas)
        {
            canvas.SetOrientation(NwazetGoImaging.Orientation.Portrait);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(35, 10, (ushort)NwazetGoImaging.BasicColor.Black, NwazetGoFonts.DejaVuSansBold9.ID, "Herd Rider by Larouex");
            canvas.Execute();

            /*
             * canvas.DrawString(5, 30, (ushort)BasicColor.Black, DejaVuSans9.ID, "DejaVu Sans 9");
             * canvas.DrawString(5, 50, (ushort)BasicColor.Black, DejaVuSansMono8.ID, "DejaVu Sans Mono 8");
             * canvas.SetOrientation(Orientation.Landscape);
             * canvas.DrawString(5, 10, (ushort)BasicColor.Black, DejaVuSans9.ID, "DejaVu Sans 9 (Rotated)");
             * canvas.SetOrientation(Orientation.Portrait);
             * RenderPrimitiveShapes(canvas);
             *
             * var fontInfo = new DejaVuSans9().GetFontInfo();
             *
             * RenderCompoundShapes(canvas, fontInfo);
             * RenderIcons(canvas);
             *
             * var button = new ButtonWidget(20, 285, 200, 25, fontInfo, "Continue Demo");
             * canvas.RegisterWidget(button);
             * canvas.RenderWidgets();
             * while (!button.Clicked) {
             *  canvas.TouchscreenWaitForEvent();
             * }
             * button.Dirty = true;
             * canvas.RenderWidgets();
             * canvas.Execute();
             * canvas.UnRegisterWidget(button);
             * */
        }
Example #3
0
 public static void RenderCompoundShapes(
     NwazetGoImaging.VirtualCanvas canvas,
     NwazetGoFonts.FontInfo fontInfo)
 {
     canvas.DrawProgressBar(
         70, 140,
         75, 12,
         CornerStyle,
         CornerStyle,
         (ushort)NwazetGoImaging.BasicColor.Black,
         (ushort)NwazetGoImaging.GrayScaleValues.Gray_128,
         (ushort)NwazetGoImaging.GrayScaleValues.Gray_30,
         (ushort)NwazetGoImaging.BasicColor.Green,
         78);
     canvas.DrawString(5, 144, (ushort)NwazetGoImaging.BasicColor.Black, fontInfo.ID, "Progress");
     canvas.DrawString(155, 144, (ushort)NwazetGoImaging.BasicColor.Black, fontInfo.ID, "78%");
     canvas.DrawRectangleFilled(0, 275, 239, 319, (ushort)NwazetGoImaging.GrayScaleValues.Gray_80);
 }
Example #4
0
        public static void BasicTouchEventTest(
            NwazetGoImaging.VirtualCanvas canvas)
        {
            var message      = "Touch Event Test";
            var fontInfo     = new NwazetGoFonts.DejaVuSansBold9().GetFontInfo();
            var stringLength = fontInfo.GetStringWidth(message);

            canvas.DrawFill(ColorBackground);
            canvas.DrawString(
                (canvas.Width - stringLength) / 2, 150,
                (ushort)NwazetGoImaging.BasicColor.Black, fontInfo.ID, message);

            canvas.TouchscreenWaitForEvent();

            canvas.DrawCircleFilled(lastTouchX, lastTouchY, 4, (ushort)NwazetGoImaging.BasicColor.Red);
            canvas.Execute();

            Thread.Sleep(1000);
        }
Example #5
0
 public static void RenderCompoundShapes(VirtualCanvas canvas, FontInfo fontInfo) {
     canvas.DrawProgressBar(
         70, 140,
         75, 12,
         CornerStyle,
         CornerStyle,
         (ushort)BasicColor.Black,
         (ushort)GrayScaleValues.Gray_128,
         (ushort)GrayScaleValues.Gray_30,
         (ushort)BasicColor.Green,
         78);
     canvas.DrawString(5, 144, (ushort)BasicColor.Black, fontInfo.ID, "Progress");
     canvas.DrawString(155, 144, (ushort)BasicColor.Black, fontInfo.ID, "78%");
     canvas.DrawRectangleFilled(0, 275, 239, 319, (ushort)GrayScaleValues.Gray_80);
 }
Example #6
0
        public static void BasicUITest(VirtualCanvas canvas) {
            canvas.SetOrientation(Orientation.Portrait);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(5, 10, (ushort)BasicColor.Black, DejaVuSansBold9.ID, "DejaVu Sans 9 Bold");
            canvas.DrawString(5, 30, (ushort)BasicColor.Black, DejaVuSans9.ID, "DejaVu Sans 9");
            canvas.DrawString(5, 50, (ushort)BasicColor.Black, DejaVuSansMono8.ID, "DejaVu Sans Mono 8");
            canvas.SetOrientation(Orientation.Landscape);
            canvas.DrawString(5, 10, (ushort)BasicColor.Black, DejaVuSans9.ID, "DejaVu Sans 9 (Rotated)");
            canvas.SetOrientation(Orientation.Portrait);
            RenderPrimitiveShapes(canvas);

            var fontInfo = new DejaVuSans9().GetFontInfo();

            RenderCompoundShapes(canvas, fontInfo);
            RenderIcons(canvas);

            var button = new ButtonWidget(20, 285, 200, 25, fontInfo, "Continue Demo");
            canvas.RegisterWidget(button);
            canvas.RenderWidgets();
            while (!button.Clicked) {
                canvas.TouchscreenWaitForEvent();
            }
            button.Dirty = true;
            canvas.RenderWidgets();
            canvas.Execute();
            canvas.UnRegisterWidget(button);
        }
Example #7
0
        public static void BasicTouchEventTest(VirtualCanvas canvas) {
            var message = "Touch Event Test";
            var fontInfo = new DejaVuSansBold9().GetFontInfo();
            var stringLength = fontInfo.GetStringWidth(message);
            canvas.SetOrientation(Orientation.Portrait);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(
                (canvas.Width - stringLength) / 2, 150,
                (ushort)BasicColor.Black, fontInfo.ID, message);

            canvas.TouchscreenWaitForEvent();

            canvas.DrawCircleFilled(lastTouchX, lastTouchY, 4, (ushort)BasicColor.Red);
            canvas.Execute();

            Thread.Sleep(1000);
        }
Example #8
0
        public static void NonBlockingTouchEventTest(VirtualCanvas canvas) {
            var message = "Touch To Continue";
            var fontInfo = new DejaVuSansBold9().GetFontInfo();
            var stringLength = fontInfo.GetStringWidth(message);
            canvas.DrawFill(ColorBackground);
            canvas.DrawString(
                (canvas.Width - stringLength) / 2, 150,
                (ushort)BasicColor.Black, fontInfo.ID, message);

            var random = new Random(lastTouchX * lastTouchY);
            lastTouchIsValid = 0;
            while (lastTouchIsValid == 0) {
                canvas.DrawCircleFilled(random.Next(canvas.Width), random.Next(canvas.Height), 4, (ushort)BasicColor.Red);
                canvas.Execute();
                canvas.TouchscreenWaitForEvent(TouchScreenEventMode.NonBlocking);
            }
        }