コード例 #1
0
ファイル: ExampleGLTriangle.cs プロジェクト: gatm50/monoberry
        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
ファイル: ExamplePaint.cs プロジェクト: gatm50/monoberry
        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
ファイル: ExampleHelloWorld.cs プロジェクト: gatm50/monoberry
        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
        private Window CreateBackgroundWindow(string groupName, Context ctx)
        {
            Window wind = new Window(ctx);
            wind.CreateWindowGroup(groupName);
            wind.IsVisible = false;

            int color = unchecked((int)13493586);
            wind.Color = color;

            wind.CreateBuffer();
            wind.SetDimensions(700, 500);

            wind.Identifier = "ID500";

            return wind;
        }
コード例 #5
0
ファイル: FallingBlocks.cs プロジェクト: gatm50/monoberry
 public void Run()
 {
     _ctx = new Context(BlackberryPlatformServices.Screen.Types.ContextType.SCREEN_APPLICATION_CONTEXT);
     PlatformServices.Initialize();
     using (var win = new Window(_ctx, WindowType.SCREEN_APPLICATION_WINDOW))
     {
         _util = new BBUtil(_ctx);
         this.Initialize();
         string groupName = "TheTeam";
         win.CreateWindowGroup(groupName);
         win.CreateBuffer();
         while (true)
         {
             this.Draw();
         }
     }
 }
コード例 #6
0
ファイル: RotatingSquare.cs プロジェクト: gatm50/monoberry
        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();
            }
        }
コード例 #7
0
ファイル: ExampleGLCube.cs プロジェクト: gatm50/monoberry
        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);
                };
            }
        }
コード例 #8
0
ファイル: Context.cs プロジェクト: gatm50/monoberry
 internal void UnregisterWindow(Window win)
 {
     _windows.Remove(win.Handle);
 }
コード例 #9
0
ファイル: Context.cs プロジェクト: gatm50/monoberry
 internal void RegisterWindow(Window win)
 {
     _windows.Add(win.Handle, win);
 }
コード例 #10
0
ファイル: ScreenEffect.cs プロジェクト: gatm50/monoberry
 public ScreenEffect(Window win)
 {
     _window = win;
 }
コード例 #11
0
ファイル: Display.cs プロジェクト: gatm50/monoberry
 public void ShareDisplayBuffers(Window win, int count=0)
 {
     if (screen_share_display_buffers(win.Handle, _handle, count) != 0)
         throw new Exception("Unable to share buffers.");
 }