public static void MultiWidgetTest(VirtualCanvas canvas) { canvas.SetOrientation(Orientation.Landscape); canvas.DrawFill(ColorHelpers.GetRGB24toRGB565(255, 255, 255)); var fontInfo = new DejaVuSans9().GetFontInfo(); var redButton = new ButtonWidget(10, 204, 44, 22, fontInfo, "Red"); redButton.FillColor = ColorHelpers.GetRGB24toRGB565(255, 0, 0); redButton.FillColorClicked = ColorHelpers.GetRGB24toRGB565(255, 255, 255); redButton.FontColorClicked = ColorHelpers.GetRGB24toRGB565(255, 0, 0); var greenButton = new ButtonWidget(60, 204, 44, 22, fontInfo, "Green"); greenButton.FillColor = ColorHelpers.GetRGB24toRGB565(0, 255, 0); greenButton.FillColorClicked = ColorHelpers.GetRGB24toRGB565(255, 255, 255); greenButton.FontColorClicked = ColorHelpers.GetRGB24toRGB565(0, 255, 0); var blueButton = new ButtonWidget(110, 204, 44, 22, fontInfo, "Blue"); blueButton.FillColor = ColorHelpers.GetRGB24toRGB565(0, 0, 255); blueButton.FillColorClicked = ColorHelpers.GetRGB24toRGB565(255, 255, 255); blueButton.FontColorClicked = ColorHelpers.GetRGB24toRGB565(0, 0, 255); var continueButton = new ButtonWidget(247, 204, 64, 22, fontInfo, "Continue"); continueButton.FillColor = ColorHelpers.GetRGB24toRGB565(255, 255, 255); continueButton.FontColorClicked = ColorHelpers.GetRGB24toRGB565(0, 0, 0); canvas.RegisterWidget(redButton); canvas.RegisterWidget(greenButton); canvas.RegisterWidget(blueButton); canvas.RegisterWidget(continueButton); canvas.WidgetClicked += ColorButtonsClickedHandler; canvas.RenderWidgets(); while (!continueButton.Clicked) { canvas.ActivateWidgets(true); canvas.RenderWidgets(); canvas.Execute(); canvas.TouchscreenWaitForEvent(); canvas.RenderWidgets(Render.All); canvas.Execute(); } canvas.WidgetClicked -= ColorButtonsClickedHandler; continueButton.Dirty = true; continueButton.Draw(canvas); canvas.Execute(); canvas.UnRegisterAllWidgets(); }
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); }
public MainMenu(VirtualCanvas canvas) { TemperatureAndRelayButton = new ButtonWidget(10, 22, 250, 27, fontInfo.GetFontInfo(), "Temperature & Relay"); ImageGalleryButton = new ButtonWidget(10, 53, 250, 27, fontInfo.GetFontInfo(), "Image Gallery"); BasicUIButton = new ButtonWidget(10, 83, 250, 27, fontInfo.GetFontInfo(), "Basic UI"); LEDMarqueeButton = new ButtonWidget(10, 113, 250, 27, fontInfo.GetFontInfo(), "LED Marquee"); LEDRGBArtButton = new ButtonWidget(10, 143, 250, 27, fontInfo.GetFontInfo(), "LED RGB Art"); LEDCaptureTheDotButton = new ButtonWidget(10, 173, 250, 27, fontInfo.GetFontInfo(), "LED Capture The Dot"); LEDSignShowcaseButton = new ButtonWidget(10, 203, 250, 27, fontInfo.GetFontInfo(), "LED Sign Showcase"); canvas.RegisterWidget(TemperatureAndRelayButton); canvas.RegisterWidget(ImageGalleryButton); canvas.RegisterWidget(BasicUIButton); canvas.RegisterWidget(LEDMarqueeButton); canvas.RegisterWidget(LEDRGBArtButton); canvas.RegisterWidget(LEDCaptureTheDotButton); canvas.RegisterWidget(LEDSignShowcaseButton); }