コード例 #1
0
 public NSGameView(Lime.Input input, CGRect frame, GraphicsMode mode)
     : base(frame)
 {
     this.input  = input;
     this.Hidden = true;
     // Avoid of double scaling on high DPI displays
     this.WantsBestResolutionOpenGLSurface = true;
     pixelFormat = SelectPixelFormat(mode, 1, 0);
     if (pixelFormat == null)
     {
         throw new InvalidOperationException(string.Format("Failed to contruct NSOpenGLPixelFormat for GraphicsMode {0}", mode));
     }
     if (openGLContext == null)
     {
         openGLContext = new NSOpenGLContext(pixelFormat, null);
     }
     if (openGLContext == null)
     {
         throw new InvalidOperationException(string.Format("Failed to construct NSOpenGLContext {0}", mode));
     }
     openGLContext.MakeCurrentContext();
     if (platformRenderContext == null)
     {
         platformRenderContext = new Graphics.Platform.OpenGL.PlatformRenderContext();
         PlatformRenderer.Initialize(platformRenderContext);
     }
     swapInterval = true;
 }
コード例 #2
0
ファイル: DialogHelper.cs プロジェクト: zhamppx97/maui
        public static void ShowActionSheet(PlatformRenderer platformRender, ActionSheetArguments arguments)
        {
            MessageDialog messageDialog = new MessageDialog(
                platformRender.Toplevel as Window,
                DialogFlags.DestroyWithParent,
                MessageType.Other,
                ButtonsType.Cancel,
                null);

            SetDialogTitle(arguments.Title, messageDialog);
            SetButtonText(arguments.Cancel, ButtonsType.Cancel, messageDialog);
            SetDestructionButton(arguments.Destruction, messageDialog);
            AddExtraButtons(arguments, messageDialog);

            int result = messageDialog.Run();

            if ((ResponseType)result == ResponseType.Cancel)
            {
                arguments.SetResult(arguments.Cancel);
            }
            else if ((ResponseType)result == ResponseType.Reject)
            {
                arguments.SetResult(arguments.Destruction);
            }

            messageDialog.Destroy();
        }
コード例 #3
0
ファイル: DialogHelper.cs プロジェクト: zhamppx97/maui
        public static void ShowAlert(PlatformRenderer platformRender, AlertArguments arguments)
        {
            MessageDialog messageDialog = new MessageDialog(
                platformRender.Toplevel as Window,
                DialogFlags.DestroyWithParent,
                MessageType.Other,
                GetAlertButtons(arguments),
                arguments.Message);

            SetDialogTitle(arguments.Title, messageDialog);
            SetButtonText(arguments.Accept, ButtonsType.Ok, messageDialog);
            SetButtonText(arguments.Cancel, ButtonsType.Cancel, messageDialog);

            ResponseType result = (ResponseType)messageDialog.Run();

            if (result == ResponseType.Ok)
            {
                arguments.SetResult(true);
            }
            else
            {
                arguments.SetResult(false);
            }

            messageDialog.Destroy();
        }
コード例 #4
0
        void InternalSetPage(Page page)
        {
            if (!Forms.IsInitialized)
            {
                throw new InvalidOperationException("Call Forms.Init (Activity, Bundle) before this");
            }

            if (_canvas != null)
            {
                _canvas.SetPage(page);
                return;
            }

            _canvas = new Platform();
            var platformRenderer = new PlatformRenderer(_canvas);

            if (_application != null)
            {
                _application.Platform = _canvas;
            }

            _canvas.SetPage(page);

            var view     = _canvas.PlatformRenderer;
            var renderer = new SKViewRenderer(view, this);

            _layout.AddView(renderer);
        }
コード例 #5
0
        private void UpdateMainPage()
        {
            if (_application.MainPage == null)
            {
                return;
            }

            var page = _application.MainPage;

            if (_canvas != null)
            {
                _canvas.SetPage(page);
                return;
            }

            _canvas = new Platform();
            var platformRenderer = new PlatformRenderer(_canvas);

            if (_application != null)
            {
                _application.Platform = _canvas;
            }

            _canvas.SetPage(page);

            var view     = _canvas.PlatformRenderer;
            var renderer = new SKViewRenderer(view);

            Window.RootViewController = new UIViewController
            {
                View = renderer
            };
        }
コード例 #6
0
        public Platform(Context context)
        {
            _context = context;

            _renderer = new PlatformRenderer(context, this);

            FormsAppCompatActivity.BackPressed += HandleBackPressed;
        }
コード例 #7
0
ファイル: Platform.cs プロジェクト: Costo/Xamarin.Forms
		public Platform(Context context)
		{
			_context = context;

			_renderer = new PlatformRenderer(context, this);

			FormsAppCompatActivity.BackPressed += HandleBackPressed;
		}
コード例 #8
0
 void RenderGizmo(Node3D node)
 {
     Renderer.Flush();
     Renderer.World    = CalcGizmoTransform(node.GlobalTransform, 100);
     Renderer.CullMode = CullMode.CullClockwise;
     WidgetMaterial.Diffuse.Apply(0);
     PlatformRenderer.DrawTriangles(gizmo, 0, gizmo.IndexBuffer.Data.Length);
 }
コード例 #9
0
 public void Apply(int pass)
 {
     shaderParams.Set(dilateKey, 0.5f - Dilate * 0.01f);
     shaderParams.Set(softnessKey, Mathf.Max(Softness * 0.01f, 0.001f));
     shaderParams.Set(colorKey, Color.ToVector4());
     PlatformRenderer.SetBlendState(Blending.GetBlendState());
     PlatformRenderer.SetShaderProgram(SDFShadowShaderProgram.GetInstance());
     PlatformRenderer.SetShaderParams(shaderParamsArray);
 }
コード例 #10
0
ファイル: Platform.cs プロジェクト: bholmes/Xamarin.Forms
        public Platform(Context context, bool embedded)
        {
            _embedded   = embedded;
            _context    = context;
            PackageName = context?.PackageName;
            _renderer   = new PlatformRenderer(context, this);
            var activity = _context.GetActivity();

            if (embedded && activity != null)
            {
                // Set up handling of DisplayAlert/DisplayActionSheet/UpdateProgressBarVisibility
                if (_context == null)
                {
                    // Can't show dialogs if it's not an activity
                    return;
                }

                PopupManager.Subscribe(_context.GetActivity());
                return;
            }

            FormsAppCompatActivity.BackPressed += HandleBackPressed;
        }