Пример #1
0
        public void Run()
        {
            BBUtil _util;
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx))
            {
                _util = new BBUtil(ctx);

                Egl.QuerySurface(_util.Display, _util.Surface, Egl.WIDTH, out viewportWidth);
                Egl.QuerySurface(_util.Display, _util.Surface, Egl.HEIGHT, out viewportHeight);

                Console.WriteLine("viewportWidth: " + viewportWidth);
                Console.WriteLine("viewportHeight: " + viewportHeight);

                this.OnLoad(_util);

                nav.OnExit += () =>
                {
                    Console.WriteLine("I am asked to shutdown!?!");
                    PlatformServices.Shutdown(0);
                };

                PlatformServices.Run(null);
            }
        }
Пример #2
0
        public void Run()
        {
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx))
            {
                win.Usage = UsageFlagType.SCREEN_USAGE_NATIVE;
                win.CreateBuffers(2);
                var bufs = win.Buffers;
                var pic = bufs[0];
                var brush = bufs[1];

                Blits.Fill(ctx, pic, 64441078);
                Blits.Fill(ctx, brush, 0xffff0000 );
                win.Render(pic);

                nav.OnSwipeDown += (() => Dialog.Alert ("#MonoBerry", "Another Event Loop", new Button ("Ack")));
                ctx.OnFingerTouch += (x, y) =>
                {
                    Blits.Blit(ctx, brush, pic, 0, 0, 10, 10, Math.Max(x - 5, 0), Math.Max(y - 5, 0));
                    win.Render(pic);
                };
                ctx.OnFingerMove = ctx.OnFingerTouch;
                ctx.OnFingerRelease = ctx.OnFingerTouch;

                nav.OnExit += () =>
                {
                    Console.WriteLine("I am asked to shutdown!?!");
                    PlatformServices.Shutdown(0);
                };

                PlatformServices.Run(null);
            }
        }
Пример #3
0
        public void Run()
        {
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx, WindowType.SCREEN_APPLICATION_WINDOW))
            {
                string groupName = "TheTeam";
                win.CreateWindowGroup(groupName);

                win.CreateBuffers(10);
                win.Identifier = "parent";

                var r = new Random();
                foreach (var b in win.Buffers)
                {
                    Blits.Fill(ctx, b, (uint)r.Next());
                    win.Render(b);
                    System.Threading.Thread.Sleep(200);
                }

                Window childWindow = new Window(ctx, WindowType.SCREEN_CHILD_WINDOW);
                childWindow.JoinWindowGroup(groupName);
                childWindow.CreateBuffer();
                childWindow.Identifier = "child";

                Blits.Fill(ctx, childWindow.Buffers[0], 50);
                childWindow.Render(childWindow.Buffers[0]);

                SoundPlayer sp = new SoundPlayer(SoundPlayer.SystemSounds.EventDeviceUntether);
                sp.PlaySound();
                VirtualKeyboard kb = new VirtualKeyboard();
                Orientation or= new Orientation();
                var run = true;
                string message=string.Format("Monoberry Runtime!. BPS Version: {0} Direction: {1}",PlatformServices.GetVersionBPS().ToString(), or.CurrentDirection.ToString());
                while (run)
                {
                    Dialog.Alert("CLOSE ME!", message,
                        //new Button ("Timer", Timer),
                        //new Button ("Camera", Cam),
                        //new Button ("Messages", () => nav.Invoke ("messages://")),
                                  //new Button("Show Keyboard", () => kb.Show()),
                                  new Button("Play Random Sound", () => this.PlaySound(sp, r)),
                                  new Button("Badge", () => nav.HasBadge = true),
                                  new Button("Browser", () => nav.Invoke("http://www.bing.com/")),
                                  new Button("Close", () => run = false));
                }
            }
        }
Пример #4
0
        public void Run()
        {
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx))
            {
                _util = new BBUtil(ctx);

                this.Initialize();
                nav.RotationLock = false;
                bool exit_application = false;

                nav.OnExit = () =>
                {
                    Console.WriteLine("I am asked to shutdown!?!");
                    PlatformServices.Shutdown(0);
                    exit_application = true;
                };

                //while (!exit_application)
                //{
                    //Event e = null;
                    //for (; ; )
                    //{
                    //    PlatformServices.GetEvent(out e, 0);
                    //    if (e != null)
                    //    {
                    //        int domain = PlatformServices.GetDomainByEvent(e.Handle);

                    //        if (domain == Screen.GetDomain())
                    //            this.handleScreenEvent(e);
                    //        else if (domain == nav.Domain && (int)e.Code == (int)Navigator.EventType.NAVIGATOR_EXIT)
                    //            exit_application = true;
                    //    }
                    //    else
                    //        break;
                    //}

                    this.Render();
                //}
                PlatformServices.Run(this.Render);
                _util.Dispose();
            }
        }
Пример #5
0
        public void Run()
        {
            _rateOfRotationPS = new float[] { 30, 45, 60 };
            _rot = new float[] { 0, 0, 0 };

            BBUtil _util;
            using (var nav = new Navigator())
            using (var ctx = new Context(ContextType.SCREEN_APPLICATION_CONTEXT))
            using (var win = new Window(ctx))
            {
                _util = new BBUtil(ctx);

                Egl.QuerySurface(_util.Display, _util.Surface, Egl.WIDTH, out _viewportWidth);
                Egl.QuerySurface(_util.Display, _util.Surface, Egl.HEIGHT, out _viewportHeight);

                this.OnLoad(_util);

                nav.OnExit += () =>
                {
                    Console.WriteLine("I am asked to shutdown!?!");
                    PlatformServices.Shutdown(0);
                };
            }
        }