コード例 #1
0
        /// <summary>
        /// Testing method for DisplayNHVN module
        /// </summary>
        private static void TestGlide()
        {
            var lcd = new DisplayNHVN(GHIElectronics.TinyCLR.Pins.FEZRaptor.I2cBus.Socket13, FEZRaptor.Socket16.Pin9, FEZRaptor.Socket13.Pin3,
                                      DisplayNHVN.DisplayTypes.Display7inch);

            Glide.SetupGlide(800, 480, 96, 0, lcd.displayController);
            string GlideXML = @"<Glide Version=""1.0.7""><Window Name=""instance115"" Width=""800"" Height=""480"" BackColor=""dce3e7""><Button Name=""btn"" X=""40"" Y=""60"" Width=""120"" Height=""40"" Alpha=""255"" Text=""Click Me"" Font=""4"" FontColor=""000000"" DisabledFontColor=""808080"" TintColor=""000000"" TintAmount=""0""/><TextBlock Name=""TxtTest"" X=""42"" Y=""120"" Width=""650"" Height=""32"" Alpha=""255"" Text=""TextBlock"" TextAlign=""Left"" TextVerticalAlign=""Top"" Font=""6"" FontColor=""0"" BackColor=""000000"" ShowBackColor=""False""/></Window></Glide>";

            //Resources.GetString(Resources.StringResources.Window)
            Window window = GlideLoader.LoadWindow(GlideXML);

            GlideTouch.Initialize();

            GHI.Glide.UI.Button    btn = (GHI.Glide.UI.Button)window.GetChildByName("btn");
            GHI.Glide.UI.TextBlock txt = (GHI.Glide.UI.TextBlock)window.GetChildByName("TxtTest");
            btn.TapEvent += (object sender) =>
            {
                txt.Text = "Welcome to Glide for TinyCLR - Cheers from Mif ;)";
                Debug.WriteLine("Button tapped.");

                window.Invalidate();
                txt.Invalidate();
            };

            Glide.MainWindow = window;

            lcd.CapacitiveScreenReleased += Lcd_CapacitiveScreenReleased;
            lcd.CapacitiveScreenPressed  += Lcd_CapacitiveScreenPressed;

            //Thread.Sleep(Timeout.Infinite);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Gravicode/GlideTinyCLR2
        public void StartProgram()
        {
            Debug.WriteLine("Program Started");
            var lcd = new DisplayDriver43(SC20260.GpioPin.PA15);

            Glide.SetupGlide(480, 272, 96, 0, lcd.display);
            Screens = new Hashtable();
            //populate all form
            var F1 = new SplashForm(ref MainWindow);

            F1.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.Splash, F1);

            var F2 = new MainMenuForm(ref MainWindow);

            F2.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.MainMenu, F2);

            var F6 = new GameForm(ref MainWindow, ref lcd);

            F6.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.Game, F6);
            //init glide touch
            Glide.FitToScreen = true;
            GlideTouch.Initialize();
            //enable touch screen
            lcd.CapacitiveScreenReleased += Lcd_CapacitiveScreenReleased;
            lcd.CapacitiveScreenPressed  += Lcd_CapacitiveScreenPressed;
            lcd.CapacitiveScreenMove     += Lcd_CapacitiveScreenMove;
            //load splash
            LoadForm(Screen.ScreenTypes.Splash);
        }